ref: eeee1a2e9546c84a6cba87510ec702613cc55d0e
parent: 509727e2255e4dd17bf397a5d99974e33855e97c
parent: ad38cfe46c365d815e6aa41557a5943a33b680c2
author: dongzha <dongzha@cisco.com>
date: Mon Dec 15 08:35:36 EST 2014
Merge pull request #1622 from dongzha/setunuse 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;
}