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
690 ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1];690 ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1];
691 ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2];691 ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2];
692 m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32;692 m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32;
693 m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true;
693 m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false;694 m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false;
694 m_iMinPOC = sIMinInt32;695 m_iMinPOC = sIMinInt32;
695 --m_iNumOfPicts;696 --m_iNumOfPicts;
@@ -743,14 +744,8 @@ void CWelsDecoder::OutputStatisticsLog (SDecoderStatistics& sDecoderStatistics) · 47 unmodified lines
743}744}
744 745
745DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SBufferInfo* pDstInfo) {746DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SBufferInfo* pDstInfo) {
747 DECODING_STATE iRet = dsErrorFree;
746 if (pDstInfo->iBufferStatus == 1 && m_pDecContext->pSps->uiProfileIdc != 66) {748 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 }
754 if (m_pDecContext->pSliceHeader->iPicOrderCntLsb == 0) {749 if (m_pDecContext->pSliceHeader->iPicOrderCntLsb == 0) {
755 if (m_iNumOfPicts > 0) {750 if (m_iNumOfPicts > 0) {
756 m_iLastGOPRemainPicts = m_iNumOfPicts;751 m_iLastGOPRemainPicts = m_iNumOfPicts;
@@ -768,7 +763,8 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SB · 11 unmodified lines
768 m_sPictInfoList[i].pData[1] = ppDst[1];763 m_sPictInfoList[i].pData[1] = ppDst[1];
769 m_sPictInfoList[i].pData[2] = ppDst[2];764 m_sPictInfoList[i].pData[2] = ppDst[2];
770 m_sPictInfoList[i].iPOC = m_pDecContext->pSliceHeader->iPicOrderCntLsb;765 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;
772 m_sPictInfoList[i].bLastGOP = false;768 m_sPictInfoList[i].bLastGOP = false;
773 pDstInfo->iBufferStatus = 0;769 pDstInfo->iBufferStatus = 0;
774 ++m_iNumOfPicts;770 ++m_iNumOfPicts;
@@ -801,6 +797,7 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SB · 26 unmodified lines
801 ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1];797 ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1];
802 ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2];798 ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2];
803 m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32;799 m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32;
800 m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true;
804 m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false;801 m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false;
805 m_iMinPOC = sIMinInt32;802 m_iMinPOC = sIMinInt32;
806 --m_iNumOfPicts;803 --m_iNumOfPicts;
@@ -808,7 +805,7 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SB · 1 unmodified line
808 if (m_iLastGOPRemainPicts == 0) {805 if (m_iLastGOPRemainPicts == 0) {
809 m_LastWrittenPOC = sIMinInt32;806 m_LastWrittenPOC = sIMinInt32;
810 }807 }
811 return dsErrorFree;808 return iRet;
812 }809 }
813 if (m_iNumOfPicts > 0) {810 if (m_iNumOfPicts > 0) {
814 m_iMinPOC = sIMinInt32;811 m_iMinPOC = sIMinInt32;
@@ -837,15 +834,16 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SB · 22 unmodified lines
837 ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1];834 ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1];
838 ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2];835 ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2];
839 m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32;836 m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32;
837 m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true;
840 m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false;838 m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false;
841 m_iMinPOC = sIMinInt32;839 m_iMinPOC = sIMinInt32;
842 --m_iNumOfPicts;840 --m_iNumOfPicts;
843 return dsErrorFree;841 return iRet;
844 }842 }
845 }843 }
846 }844 }
847 845
848 return dsErrorFree;846 return iRet;
849}847}
850 848
851DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc,849DECODING_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