Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 1 file). Show all
Unified · Split
| @@ -213,6 +213,21 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 212 unmodified lines | ||
| 213 | 213 | if (iPrevPicIdx != iPicIdx) { |
| 214 | 214 | if (pPicOldBuf->ppPic[iPicIdx] != NULL) { |
| 215 | 215 | FreePicture (pPicOldBuf->ppPic[iPicIdx], pMa); |
| 216 | + //seach and reset the references of deleted references. | |
| 217 | + for (int32_t list = LIST_0; list < LIST_A; ++list) { | |
| 218 | + int32_t refIdx = 0; | |
| 219 | + PPicture pPic = pCtx->sRefPic.pRefList[list][refIdx]; | |
| 220 | + while (refIdx < MAX_DPB_COUNT && pPic != NULL) { | |
| 221 | + ++refIdx; | |
| 222 | + int32_t ref = 0; | |
| 223 | + while (ref < MAX_DPB_COUNT && *pPic->pRefPic[ref] != NULL) { | |
| 224 | + if (*pPic->pRefPic[ref] == pPicOldBuf->ppPic[iPicIdx]) { | |
| 225 | + *pPic->pRefPic[ref] = NULL; | |
| 226 | + } | |
| 227 | + ++ref; | |
| 228 | + } | |
| 229 | + } | |
| 230 | + } | |
| 216 | 231 | pPicOldBuf->ppPic[iPicIdx] = NULL; |
| 217 | 232 | } |
| 218 | 233 | } |