shithub: openh264

Download patch

ref: 7e24efc620a457ff74d5724b29b9f352c55b1468
parent: cbb6e993cf2b2a746c31768ca0c4d3a897af9148
author: Sijia Chen <[email protected]>
date: Mon Nov 17 11:39:42 EST 2014

adjust the param validation of max bit rate

--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -155,11 +155,16 @@
                  pSpatialLayer->iSpatialBitrate);
         return ENC_RETURN_INVALIDINPUT;
       }
-      if (pSpatialLayer->iMaxSpatialBitrate < pSpatialLayer->iSpatialBitrate * 1.1f) {
+      if (pSpatialLayer->iMaxSpatialBitrate == pSpatialLayer->iSpatialBitrate) {
+        WelsLog (pLogCtx, WELS_LOG_INFO,
+                 "Setting MaxSpatialBitrate (%d) the same at SpatialBitrate (%d) will make the actual bit rate lower than SpatialBitrate",
+                 pSpatialLayer->iMaxSpatialBitrate, pSpatialLayer->iSpatialBitrate);
+      }
+      if (pSpatialLayer->iMaxSpatialBitrate < pSpatialLayer->iSpatialBitrate) {
         WelsLog (pLogCtx, WELS_LOG_WARNING,
-                 "MaxSpatialBitrate (%d) should set be larger than 1.1 times of SpatialBitrate (%d)",
+                 "MaxSpatialBitrate (%d) should be lower than SpatialBitrate (%d), considering it as invalid setting, adjust it to be UNSPECIFIED(0)",
                  pSpatialLayer->iMaxSpatialBitrate, pSpatialLayer->iSpatialBitrate);
-//       pSpatialLayer->iSpatialBitrate = (int32_t) (pSpatialLayer->iMaxSpatialBitrate/1.1f);
+        pSpatialLayer->iMaxSpatialBitrate = 0;
       }
     }
     if (iTotalBitrate > pCfg->iTargetBitrate) {