shithub: aacenc

Download patch

ref: dc611893e30212f046b5e8b82a0f0700e1cfc361
parent: e52ee3dad9644d9c7a07f55d4d7e3bdc68894a5a
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Wed Aug 11 12:59:39 EDT 2021

fixup

--- a/frontend/aacenc.c
+++ b/frontend/aacenc.c
@@ -129,12 +129,15 @@
 			break;
 		if((sz = faacEncEncode(e, pcm, n/sizeof(*pcm), obuf, outsz)) < 0)
 			sysfatal("faacEncEncode");
+		else if(sz == 0)
+			continue;
+
 		if(ns != 0){
 			memmove(ph, obuf, 7);
 			/* set frame size */
 			ph[3] &= ~3;
 			ph[4] = sizeof(ph)>>3;
-			ph[5] = (ph[5]&~0xe0) | sizeof(ph)<<4;
+			ph[5] = (ph[5]&~0xe0) | sizeof(ph)<<5;
 			ph[7] = 0x04; /* DSE */
 			ph[8] = 'n';
 			ph[9] = 's';
@@ -143,7 +146,8 @@
 			for(i = 0; i < 8; i++, ns >>= 8)
 				ph[12+i] = ns;
 			ns = 0;
-			Bwrite(&out, ph, sizeof(ph));
+			if(Bwrite(&out, ph, sizeof(ph)) < 0)
+				break;
 		}
 		if(Bwrite(&out, obuf, sz) < 0)
 			break;