shithub: openh264

Download patch

ref: 58e868c0741b8e2c7c3c8ea65ff47148527d9dc6
parent: 8dbdb418cac6500a4d145c8d7d6c41401365799d
parent: 4746ce8fd4929b2f99031d9184a4517676d6eec9
author: ruil2 <ruil2@cisco.com>
date: Wed Dec 17 10:51:52 EST 2014

Merge pull request #1643 from mstorsjo/check-num-refs

If lowering the maximum number of ref frames, check iNumRefFrames as well

--- a/codec/encoder/core/src/au_set.cpp
+++ b/codec/encoder/core/src/au_set.cpp
@@ -98,8 +98,11 @@
       WelsLog (pLogCtx, WELS_LOG_WARNING, "change level to level5.0");
     }
     iRefFrame = g_ksLevelLimits[pSpatialLayer->uiLevelIdc - 1].uiMaxDPBMbs / uiPicInMBs;
-    if (iRefFrame < pParam->iMaxNumRefFrame)
+    if (iRefFrame < pParam->iMaxNumRefFrame) {
       pParam->iMaxNumRefFrame = iRefFrame;
+      if (pParam->iMaxNumRefFrame < pParam->iNumRefFrame)
+        pParam->iNumRefFrame = pParam->iMaxNumRefFrame;
+    }
     if (pParam->iMaxNumRefFrame < 1) {
       pParam->iMaxNumRefFrame = 1;
       WelsLog (pLogCtx, WELS_LOG_ERROR, "error Level setting (%d)", pSpatialLayer->uiLevelIdc);