shithub: openh264

Download patch

ref: c13bfe6407252f64610b0c2c9aa0737054dcd71e
parent: 0252f3f346833b64a4996b49e52d79a2c43b0ba0
parent: 7e24efc620a457ff74d5724b29b9f352c55b1468
author: ruil2 <[email protected]>
date: Tue Nov 18 13:42:03 EST 2014

Merge pull request #1536 from sijchen/improve_br_valid

[Encoder] 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) {