shithub: openh264

Download patch

ref: 9993198a3c6ffac6aef85b1ae2946f12ff45d541
parent: 646d94320025b2ee70f24e83df28da28f428791d
parent: e2e106a4a452f35ffb22bd384f67616ccae4eb70
author: ruil2 <[email protected]>
date: Fri Apr 4 05:50:57 EDT 2014

Merge pull request #633 from volvet/rm_redundant_protect

remove redundant protect code

--- a/codec/encoder/core/inc/param_svc.h
+++ b/codec/encoder/core/inc/param_svc.h
@@ -495,19 +495,18 @@
 return 0;
 }
 
-static inline int32_t AllocCodingParam (SWelsSvcCodingParam** pParam, CMemoryAlign* pMa,
-                                        const int32_t kiRequestNumSpatial) {
-if (pParam == NULL || pMa == NULL || kiRequestNumSpatial < 1 || kiRequestNumSpatial > MAX_SPATIAL_LAYER_NUM)
-  return 1;
-if (*pParam != NULL) {
-  FreeCodingParam (pParam, pMa);
-}
-SWelsSvcCodingParam* pCodingParam = (SWelsSvcCodingParam*)pMa->WelsMalloc (sizeof (SWelsSvcCodingParam),
+static inline int32_t AllocCodingParam (SWelsSvcCodingParam** pParam, CMemoryAlign* pMa) {
+  if (pParam == NULL || pMa == NULL)
+    return 1;
+  if (*pParam != NULL) {
+    FreeCodingParam (pParam, pMa);
+  }
+  SWelsSvcCodingParam* pCodingParam = (SWelsSvcCodingParam*)pMa->WelsMalloc (sizeof (SWelsSvcCodingParam),
                                     "SWelsSvcCodingParam");
-if (NULL == pCodingParam)
-  return 1;
-*pParam = pCodingParam;
-return 0;
+  if (NULL == pCodingParam)
+    return 1;
+  *pParam = pCodingParam;
+  return 0;
 }
 
 }//end of namespace WelsSVCEnc
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -1896,7 +1896,7 @@
 #endif//ENABLE_TRACE_FILE
 
   pCodingParam->DetermineTemporalSettings();
-  iRet = AllocCodingParam (&pCtx->pSvcParam, pCtx->pMemAlign, pCodingParam->iSpatialLayerNum);
+  iRet = AllocCodingParam (&pCtx->pSvcParam, pCtx->pMemAlign);
   if (iRet != 0) {
     FreeMemorySvc (&pCtx);
     return iRet;