History

Fix a thread buffering bug: a few yuv frames at output can be dropped due to unexpected pDst reset. This is resolved by moving pDst into SBufferInfo data structure.

xiaotiansf committed 6 years ago

Commit aae33c01 parent cae50c75 files · +25 −25Browse files

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

Unified · Split

codec/decoder/plus/src/welsDecoderExt.cpp+12−15
@@ -944,9 +944,9 @@ DECODING_STATE CWelsDecoder::FlushFrame (unsigned char** ppDst, · 943 unmodified lines
944944 #endif
945945 #endif
946946 memcpy (pDstInfo, &m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].sBufferInfo, sizeof (SBufferInfo));
947− ppDst[0] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[0];
948− ppDst[1] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[1];
949− ppDst[2] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[2];
947+ ppDst[0] = pDstInfo->pDst[0];
948+ ppDst[1] = pDstInfo->pDst[1];
949+ ppDst[2] = pDstInfo->pDst[2];
950950 m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPOC = IMinInt32;
951951 PPicBuff pPicBuff = m_iThreadCount <= 1 ? m_pDecThrCtx[0].pCtx->pPicBuff : m_pPicBuff;
952952 if (m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx < pPicBuff->iCapacity) {
@@ -1046,9 +1046,6 @@ void CWelsDecoder::BufferingReadyPicture (PWelsDecoderContext pCtx, unsigned cha · 93 unmodified lines
10461046 for (int32_t i = 0; i < 16; ++i) {
10471047 if (m_sPictInfoList[i].iPOC == IMinInt32) {
10481048 memcpy (&m_sPictInfoList[i].sBufferInfo, pDstInfo, sizeof (SBufferInfo));
1049− m_sPictInfoList[i].pData[0] = ppDst[0];
1050− m_sPictInfoList[i].pData[1] = ppDst[1];
1051− m_sPictInfoList[i].pData[2] = ppDst[2];
10521049 m_sPictInfoList[i].iPOC = pCtx->pSliceHeader->iPicOrderCntLsb;
10531050 m_sPictInfoList[i].uiDecodingTimeStamp = pCtx->uiDecodingTimeStamp;
10541051 m_sPictInfoList[i].iPicBuffIdx = pCtx->pLastDecPicInfo->pPreviousDecodedPictureInDpb->iPicBuffIdx;
@@ -1090,9 +1087,9 @@ void CWelsDecoder::ReleaseBufferedReadyPicture (PWelsDecoderContext pCtx, unsign · 35 unmodified lines
10901087 #endif
10911088 #endif
10921089 memcpy (pDstInfo, &m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].sBufferInfo, sizeof (SBufferInfo));
1093− ppDst[0] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[0];
1094− ppDst[1] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[1];
1095− ppDst[2] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[2];
1090+ ppDst[0] = pDstInfo->pDst[0];
1091+ ppDst[1] = pDstInfo->pDst[1];
1092+ ppDst[2] = pDstInfo->pDst[2];
10961093 m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPOC = IMinInt32;
10971094 PPicture pPic = pPicBuff->ppPic[m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx];
10981095 --pPic->iRefCount;
@@ -1123,9 +1120,9 @@ void CWelsDecoder::ReleaseBufferedReadyPicture (PWelsDecoderContext pCtx, unsign · 24 unmodified lines
11231120 }
11241121 if (uiDecodingTimeStamp > 0) {
11251122 memcpy (pDstInfo, &m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].sBufferInfo, sizeof (SBufferInfo));
1126− ppDst[0] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[0];
1127− ppDst[1] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[1];
1128− ppDst[2] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[2];
1123+ ppDst[0] = pDstInfo->pDst[0];
1124+ ppDst[1] = pDstInfo->pDst[1];
1125+ ppDst[2] = pDstInfo->pDst[2];
11291126 m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPOC = IMinInt32;
11301127 PPicture pPic = pPicBuff->ppPic[m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx];
11311128 --pPic->iRefCount;
@@ -1164,9 +1161,9 @@ void CWelsDecoder::ReleaseBufferedReadyPicture (PWelsDecoderContext pCtx, unsign · 32 unmodified lines
11641161 #endif
11651162 #endif
11661163 memcpy (pDstInfo, &m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].sBufferInfo, sizeof (SBufferInfo));
1167− ppDst[0] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[0];
1168− ppDst[1] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[1];
1169− ppDst[2] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[2];
1164+ ppDst[0] = pDstInfo->pDst[0];
1165+ ppDst[1] = pDstInfo->pDst[1];
1166+ ppDst[2] = pDstInfo->pDst[2];
11701167 m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPOC = IMinInt32;
11711168 PPicture pPic = pPicBuff->ppPic[m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx];
11721169 --pPic->iRefCount;

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