shithub: openh264

Download patch

ref: 149e029c27dc227ae3a359ed3059c51ccd99f3e2
parent: 3dbc36cdda6fca7cb91825407c1dc388e511e41c
parent: 91b186ddc8208a5402db64ca92431fa5e603c9ce
author: ruil2 <[email protected]>
date: Wed Mar 25 10:12:11 EDT 2015

Merge pull request #1874 from sijchen/check_param2

[Encoder] fix a param checking for profile_idc

--- 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);
+      }
     }
   }
 }