shithub: aacenc

Download patch

ref: 2873499cdef5b25c0a38634d9d68ec7f0f1f11e6
parent: 44e918935ca8cb67633bd42dad45b16a04e0f9ee
author: Krzysztof Nikiel <knik@users.sourceforge.net>
date: Mon Aug 21 17:00:03 EDT 2017

bitrate setting fix

--- a/libfaac/frame.c
+++ b/libfaac/frame.c
@@ -163,7 +163,7 @@
 
     /* Check for correct bitrate */
     if (config->bitRate > MaxBitrate(hEncoder->sampleRate))
-		return 0;
+        config->bitRate = MaxBitrate(hEncoder->sampleRate);
 #if 0
     if (config->bitRate < MinBitrate())
         return 0;
@@ -234,7 +234,7 @@
 			config->bandWidth = f1;
 
 #ifndef DRM
-        config->bandWidth = config->bitRate * hEncoder->sampleRate * bwfac / 60000;
+        config->bandWidth = (double)config->bitRate * hEncoder->sampleRate * bwfac / 60000.0;
 #endif
     }
 
@@ -881,8 +881,8 @@
 		if (((diff > 0) && (fix > 0.0)) || ((diff < 0) && (fix < 0.0)))
 		{
 			hEncoder->aacquantCfg.quality *= (1.0 - fix);
-			if (hEncoder->aacquantCfg.quality > 300)
-				hEncoder->aacquantCfg.quality = 300;
+                        if (hEncoder->aacquantCfg.quality > MAXQUAL)
+                            hEncoder->aacquantCfg.quality = MAXQUAL;
             if (hEncoder->aacquantCfg.quality < 50)
                 hEncoder->aacquantCfg.quality = 50;
 		}