ref: 6814f504f637cd257709fd92418848f94ad80f29
parent: b402a6ab49b5b8ccd88559cf8013fa641a6d30f9
author: Huade Shi (huashi) <[email protected]>
date: Fri Mar 24 06:12:00 EDT 2017
Multi-thread-fixed: add protection for slice rc init funtion
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -2528,7 +2528,7 @@
int32_t iIdx = 0;
int32_t iSliceCount = 0;
SSpatialLayerInternal* pParamInternal = &pParam->sDependencyLayers[kiCurDid];
- if (NULL == pCurDq)
+ if (NULL == pCurDq || NULL == pBaseSlice)
return;
pCurDq->pDecPic = pDecPic;
@@ -3773,21 +3773,6 @@
pParam->sSliceArgument.uiSliceMode, pCtx->iEncoderError);
return pCtx->iEncoderError;
}
-
- //TO DO: add update ppSliceInLayer module based on pSliceInThread[ThreadNum]
- // UpdateSliceInLayerInfo(); // reordering
-
- //TO DO: add update ppSliceInLayer module based on pSliceInThread[ThreadNum]
- // UpdateSliceInLayerInfo(); // reordering
-
- //TO DO: add update ppSliceInLayer module based on pSliceInThread[ThreadNum]
- // UpdateSliceInLayerInfo(); // reordering
-
- //TO DO: add update ppSliceInLayer module based on pSliceInThread[ThreadNum]
- // UpdateSliceInLayerInfo(); // reordering
-
- //TO DO: add update ppSliceInLayer module based on pSliceInThread[ThreadNum]
- // UpdateSliceInLayerInfo(); // reordering
//TO DO: add update ppSliceInLayer module based on pSliceInThread[ThreadNum]
// UpdateSliceInLayerInfo(); // reordering
--- a/codec/encoder/core/src/svc_encode_slice.cpp
+++ b/codec/encoder/core/src/svc_encode_slice.cpp
@@ -1094,6 +1094,10 @@
}
void InitSliceHeadWithBase (SSlice* pSlice, SSlice* pBaseSlice) {
+ if(NULL == pSlice || NULL == pBaseSlice) {
+ return;
+ }
+
SSliceHeaderExt* pBaseSHExt = &pBaseSlice->sSliceHeaderExt;
SSliceHeaderExt* pSHExt = &pSlice->sSliceHeaderExt;
@@ -1105,6 +1109,10 @@
}
void InitSliceRefInfoWithBase (SSlice* pSlice, SSlice* pBaseSlice, const uint8_t kuiRefCount) {
+ if( NULL == pSlice || NULL == pBaseSlice) {
+ return;
+ }
+
SSliceHeaderExt* pBaseSHExt = &pBaseSlice->sSliceHeaderExt;
SSliceHeaderExt* pSHExt = &pSlice->sSliceHeaderExt;
@@ -1165,6 +1173,10 @@
memcpy (pNewSliceList, pSliceList, sizeof (SSlice) * kiMaxSliceNumOld);
iSliceIdx = kiMaxSliceNumOld;
pBaseSlice = &pSliceList[0];
+ if (NULL == pBaseSlice) {
+ FreeSliceBuffer(pNewSliceList, kiMaxSliceNumNew, pMA, "ReallocateSliceList()::InitSliceBsBuffer()");
+ return ENC_RETURN_MEMALLOCERR;
+ }
for (; iSliceIdx < kiMaxSliceNumNew; iSliceIdx++) {
pSlice = pNewSliceList + iSliceIdx;