History

Implemented a generic way to prevent the queued decoded B-frame buffers from being overwritten.

xiaotiansf committed 7 years ago

Commit c2b00041 parent 4b8913f4 files · +10 −16Browse files

Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 4 files). Show all

Unified · Split

codec/decoder/plus/src/welsDecoderExt.cpp+9−11
@@ -690,6 +690,7 @@ DECODING_STATE CWelsDecoder::FlushFrame (unsigned char** ppDst, · 689 unmodified lines
690690 ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1];
691691 ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2];
692692 m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32;
693+ m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true;
693694 m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false;
694695 m_iMinPOC = sIMinInt32;
695696 --m_iNumOfPicts;
@@ -743,14 +744,8 @@ void CWelsDecoder::OutputStatisticsLog (SDecoderStatistics& sDecoderStatistics) · 47 unmodified lines
743744 }
744745
745746 DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SBufferInfo* pDstInfo) {
747+ DECODING_STATE iRet = dsErrorFree;
746748 if (pDstInfo->iBufferStatus == 1 && m_pDecContext->pSps->uiProfileIdc != 66) {
747− //Non-reference B_FRAME (disposable) must be released and must not be buffered because its buffer could be overwritten by next reference picture.
748− if (m_pDecContext->pSliceHeader->eSliceType == B_SLICE && !m_pDecContext->pSliceHeader->bIsRefPic) {
749− if (m_pDecContext->pSliceHeader->iPicOrderCntLsb - m_LastWrittenPOC <= 2) {
750− m_LastWrittenPOC = m_pDecContext->pSliceHeader->iPicOrderCntLsb;
751− return dsErrorFree;
752− }
753− }
754749 if (m_pDecContext->pSliceHeader->iPicOrderCntLsb == 0) {
755750 if (m_iNumOfPicts > 0) {
756751 m_iLastGOPRemainPicts = m_iNumOfPicts;
@@ -768,7 +763,8 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SB · 11 unmodified lines
768763 m_sPictInfoList[i].pData[1] = ppDst[1];
769764 m_sPictInfoList[i].pData[2] = ppDst[2];
770765 m_sPictInfoList[i].iPOC = m_pDecContext->pSliceHeader->iPicOrderCntLsb;
771− m_sPictInfoList[i].iFrameNum = m_pDecContext->pSliceHeader->iFrameNum;
766+ m_sPictInfoList[i].iPicBuffIdx = m_pDecContext->pPicBuff->iCurrentIdx;
767+ m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[i].iPicBuffIdx]->bAvailableFlag = false;
772768 m_sPictInfoList[i].bLastGOP = false;
773769 pDstInfo->iBufferStatus = 0;
774770 ++m_iNumOfPicts;
@@ -801,6 +797,7 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SB · 26 unmodified lines
801797 ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1];
802798 ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2];
803799 m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32;
800+ m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true;
804801 m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false;
805802 m_iMinPOC = sIMinInt32;
806803 --m_iNumOfPicts;
@@ -808,7 +805,7 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SB · 1 unmodified line
808805 if (m_iLastGOPRemainPicts == 0) {
809806 m_LastWrittenPOC = sIMinInt32;
810807 }
811− return dsErrorFree;
808+ return iRet;
812809 }
813810 if (m_iNumOfPicts > 0) {
814811 m_iMinPOC = sIMinInt32;
@@ -837,15 +834,16 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SB · 22 unmodified lines
837834 ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1];
838835 ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2];
839836 m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32;
837+ m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true;
840838 m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false;
841839 m_iMinPOC = sIMinInt32;
842840 --m_iNumOfPicts;
843− return dsErrorFree;
841+ return iRet;
844842 }
845843 }
846844 }
847845
848− return dsErrorFree;
846+ return iRet;
849847 }
850848
851849 DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t