Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 1 file). Show all
Unified · Split
| @@ -116,10 +116,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 115 unmodified lines | ||
| 116 | 116 | } |
| 117 | 117 | // copy old PicBuf to new PicBuf |
| 118 | 118 | memcpy (pPicNewBuf->ppPic, pPicOldBuf->ppPic, kiOldSize * sizeof (PPicture)); |
| 119 | − // initialize context in queue | |
| 120 | − pPicNewBuf->iCapacity = kiNewSize; | |
| 121 | − pPicNewBuf->iCurrentIdx = pPicOldBuf->iCurrentIdx; | |
| 122 | − *ppPicBuf = pPicNewBuf; | |
| 119 | + | |
| 123 | 120 | |
| 124 | 121 | // increase new PicBuf |
| 125 | 122 | for (iPicIdx = kiOldSize; iPicIdx < kiNewSize; ++ iPicIdx) { |
| @@ -129,7 +126,18 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 3 unmodified lines | ||
| 129 | 126 | } |
| 130 | 127 | pPicNewBuf->ppPic[iPicIdx] = pPic; |
| 131 | 128 | } |
| 132 | − | |
| 129 | + // initialize context in queue | |
| 130 | + pPicNewBuf->iCapacity = kiNewSize; | |
| 131 | + pPicNewBuf->iCurrentIdx = pPicOldBuf->iCurrentIdx; | |
| 132 | + *ppPicBuf = pPicNewBuf; | |
| 133 | + | |
| 134 | + for(int32_t i = 0; i < pPicNewBuf->iCapacity; i++) { | |
| 135 | + pPicNewBuf->ppPic[i]->bUsedAsRef = false; | |
| 136 | + pPicNewBuf->ppPic[i]->bIsLongRef = false; | |
| 137 | + pPicNewBuf->ppPic[i]->uiRefCount = 0; | |
| 138 | + pPicNewBuf->ppPic[i]->bAvailableFlag = true; | |
| 139 | + pPicNewBuf->ppPic[i]->bIsComplete = false; | |
| 140 | + } | |
| 133 | 141 | // remove old PicBuf |
| 134 | 142 | if (pPicOldBuf->ppPic != NULL) { |
| 135 | 143 | WelsFree (pPicOldBuf->ppPic, "pPicOldBuf->queue"); |
| @@ -138,7 +146,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 2 unmodified lines | ||
| 138 | 146 | pPicOldBuf->iCapacity = 0; |
| 139 | 147 | pPicOldBuf->iCurrentIdx = 0; |
| 140 | 148 | WelsFree (pPicOldBuf, "pPicOldBuf"); |
| 141 | − | |
| 149 | + pPicOldBuf = NULL; | |
| 142 | 150 | return 0; |
| 143 | 151 | } |
| 144 | 152 | |
| @@ -195,6 +203,13 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 50 unmodified lines | ||
| 195 | 203 | pPicNewBuf->iCapacity = kiNewSize; |
| 196 | 204 | *ppPicBuf = pPicNewBuf; |
| 197 | 205 | |
| 206 | + for(int32_t i = 0; i < pPicNewBuf->iCapacity; i++) { | |
| 207 | + pPicNewBuf->ppPic[i]->bUsedAsRef = false; | |
| 208 | + pPicNewBuf->ppPic[i]->bIsLongRef = false; | |
| 209 | + pPicNewBuf->ppPic[i]->uiRefCount = 0; | |
| 210 | + pPicNewBuf->ppPic[i]->bAvailableFlag = true; | |
| 211 | + pPicNewBuf->ppPic[i]->bIsComplete = false; | |
| 212 | + } | |
| 198 | 213 | // remove old PicBuf |
| 199 | 214 | if (pPicOldBuf->ppPic != NULL) { |
| 200 | 215 | WelsFree (pPicOldBuf->ppPic, "pPicOldBuf->queue"); |
| @@ -203,6 +218,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 2 unmodified lines | ||
| 203 | 218 | pPicOldBuf->iCapacity = 0; |
| 204 | 219 | pPicOldBuf->iCurrentIdx = 0; |
| 205 | 220 | WelsFree (pPicOldBuf, "pPicOldBuf"); |
| 221 | + pPicOldBuf = NULL; | |
| 206 | 222 | |
| 207 | 223 | return 0; |
| 208 | 224 | } |