shithub: openh264

Download patch

ref: 15e225ab358753842bb2a39bad959a0daee78480
parent: 66447349f6aa352922ebf07050dc9b8de563b419
author: ruil2 <[email protected]>
date: Thu Jun 19 11:11:02 EDT 2014

check resolution configure

--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -91,6 +91,19 @@
       return ENC_RETURN_UNSUPPORTED_PARA;
     }
   }
+  if (pCfg->iSpatialLayerNum > 1) {
+    int32_t iFinalWidth = pCfg->sSpatialLayers[pCfg->iSpatialLayerNum - 1].iVideoWidth;
+    int32_t iFinalHeight = pCfg->sSpatialLayers[pCfg->iSpatialLayerNum - 1].iVideoWidth;
+    for (i = 0; i < (pCfg->iSpatialLayerNum - 1); i++) {
+      SSpatialLayerConfig* fDlp = &pCfg->sSpatialLayers[i];
+      if ((fDlp->iVideoWidth > iFinalWidth) || (fDlp->iVideoHeight > iFinalHeight)) {
+        WelsLog (pLogCtx, WELS_LOG_ERROR,
+                 "ParamValidation,Invalid resolution layer(%d) resolution(%d x %d) shoudl be less than the highest spatial layer resolution(%d x %d)\n ",
+                 i, fDlp->iVideoWidth, fDlp->iVideoHeight, iFinalWidth, iFinalHeight);
+        return ENC_RETURN_UNSUPPORTED_PARA;
+      }
+    }
+  }
   for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
     SSpatialLayerInternal* fDlp = &pCfg->sDependencyLayers[i];
     if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn