ref: ad38cfe46c365d815e6aa41557a5943a33b680c2
parent: cc1f3ade3a1a50b25b833344cf822998c1bc844f
author: dong zhang <dongzha@cisco.com>
date: Fri Dec 12 11:53:13 EST 2014
add set unused in dpb
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -116,11 +116,8 @@
}
// copy old PicBuf to new PicBuf
memcpy (pPicNewBuf->ppPic, pPicOldBuf->ppPic, kiOldSize * sizeof (PPicture));
- // initialize context in queue
- pPicNewBuf->iCapacity = kiNewSize;
- pPicNewBuf->iCurrentIdx = pPicOldBuf->iCurrentIdx;
- *ppPicBuf = pPicNewBuf;
+
// increase new PicBuf
for (iPicIdx = kiOldSize; iPicIdx < kiNewSize; ++ iPicIdx) {
PPicture pPic = AllocPicture (pCtx, kiPicWidth, kiPicHeight);
@@ -129,7 +126,18 @@
}
pPicNewBuf->ppPic[iPicIdx] = pPic;
}
-
+ // initialize context in queue
+ pPicNewBuf->iCapacity = kiNewSize;
+ pPicNewBuf->iCurrentIdx = pPicOldBuf->iCurrentIdx;
+ *ppPicBuf = pPicNewBuf;
+
+ for(int32_t i = 0; i < pPicNewBuf->iCapacity; i++) {
+ pPicNewBuf->ppPic[i]->bUsedAsRef = false;
+ pPicNewBuf->ppPic[i]->bIsLongRef = false;
+ pPicNewBuf->ppPic[i]->uiRefCount = 0;
+ pPicNewBuf->ppPic[i]->bAvailableFlag = true;
+ pPicNewBuf->ppPic[i]->bIsComplete = false;
+ }
// remove old PicBuf
if (pPicOldBuf->ppPic != NULL) {
WelsFree (pPicOldBuf->ppPic, "pPicOldBuf->queue");
@@ -138,7 +146,7 @@
pPicOldBuf->iCapacity = 0;
pPicOldBuf->iCurrentIdx = 0;
WelsFree (pPicOldBuf, "pPicOldBuf");
-
+ pPicOldBuf = NULL;
return 0;
}
@@ -195,6 +203,13 @@
pPicNewBuf->iCapacity = kiNewSize;
*ppPicBuf = pPicNewBuf;
+ for(int32_t i = 0; i < pPicNewBuf->iCapacity; i++) {
+ pPicNewBuf->ppPic[i]->bUsedAsRef = false;
+ pPicNewBuf->ppPic[i]->bIsLongRef = false;
+ pPicNewBuf->ppPic[i]->uiRefCount = 0;
+ pPicNewBuf->ppPic[i]->bAvailableFlag = true;
+ pPicNewBuf->ppPic[i]->bIsComplete = false;
+ }
// remove old PicBuf
if (pPicOldBuf->ppPic != NULL) {
WelsFree (pPicOldBuf->ppPic, "pPicOldBuf->queue");
@@ -203,6 +218,7 @@
pPicOldBuf->iCapacity = 0;
pPicOldBuf->iCurrentIdx = 0;
WelsFree (pPicOldBuf, "pPicOldBuf");
+ pPicOldBuf = NULL;
return 0;
}