shithub: openh264

Download patch

ref: 91b186ddc8208a5402db64ca92431fa5e603c9ce
parent: dd1d979d338e704a274163e02acd404bc2721b8c
author: Sijia Chen <[email protected]>
date: Wed Mar 25 06:02:10 EDT 2015

fix a param checking for profile_idc
reviewed at: https://rbcommons.com/s/OpenH264/r/1163/

--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -123,17 +123,27 @@
 
 void CheckProfileSetting (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int32_t iLayer, EProfileIdc uiProfileIdc) {
   SSpatialLayerConfig* pLayerInfo = &pParam->sSpatialLayers[iLayer];
-  pLayerInfo->uiProfileIdc = uiProfileIdc;
-  if ((iLayer == SPATIAL_LAYER_0) && (uiProfileIdc != PRO_BASELINE)) {
-    pLayerInfo->uiProfileIdc = PRO_BASELINE;
-    WelsLog (pLogCtx, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile",
-             uiProfileIdc);
-  }
-  if (iLayer > SPATIAL_LAYER_0) {
-    if ((uiProfileIdc != PRO_BASELINE) || (uiProfileIdc != PRO_SCALABLE_BASELINE)) {
-      pLayerInfo->uiProfileIdc = PRO_BASELINE;
-      WelsLog (pLogCtx, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile",
+  if (PRO_UNKNOWN == uiProfileIdc) {
+    pLayerInfo->uiProfileIdc = (((iLayer == SPATIAL_LAYER_0)
+                                 || pParam->bSimulcastAVC) ? PRO_BASELINE : PRO_SCALABLE_BASELINE);
+  } else {
+    pLayerInfo->uiProfileIdc = uiProfileIdc;
+    if ((iLayer == SPATIAL_LAYER_0) && (uiProfileIdc != PRO_BASELINE)) {
+      WelsLog (pLogCtx, WELS_LOG_WARNING, "doesn't support profile(%d), change to baseline profile",
                uiProfileIdc);
+      pLayerInfo->uiProfileIdc = PRO_BASELINE;
+    }
+    if (iLayer > SPATIAL_LAYER_0) {
+      if (pParam->bSimulcastAVC && (uiProfileIdc != PRO_BASELINE)) {
+        pLayerInfo->uiProfileIdc = PRO_BASELINE;
+        WelsLog (pLogCtx, WELS_LOG_WARNING, "doesn't support profile(%d) with bSimulcastAVC, change to baseline profile",
+                 uiProfileIdc);
+      }
+      if ((uiProfileIdc != PRO_BASELINE) || (uiProfileIdc != PRO_SCALABLE_BASELINE)) {
+        pLayerInfo->uiProfileIdc = PRO_BASELINE;
+        WelsLog (pLogCtx, WELS_LOG_WARNING, "doesn't support profile(%d), change to baseline profile",
+                 uiProfileIdc);
+      }
     }
   }
 }