@@ -695,9 +695,11 @@ DECODING_STATE CWelsDecoder::DecodeFrameNoDelay (const unsigned char* kpSrc,
695
695
SBufferInfo* pDstInfo) {
696
696
int iRet = dsErrorFree;
697
697
if (m_iThreadCount >= 1 ) {
698
+ SET_EVENT (&m_sReleaseBufferEvent);
698
699
iRet = ThreadDecodeFrameInternal (kpSrc, kiSrcLen, ppDst, pDstInfo);
699
700
if (m_sReoderingStatus.iNumOfPicts ) {
700
701
WAIT_EVENT (&m_sBufferingEvent, WELS_DEC_THREAD_WAIT_INFINITE);
702
+ RESET_EVENT (&m_sBufferingEvent);
701
703
RESET_EVENT (&m_sReleaseBufferEvent);
702
704
if (!m_sReoderingStatus.bHasBSlice ) {
703
705
if (m_sReoderingStatus.iNumOfPicts > 1 ) {
@@ -707,7 +709,6 @@ DECODING_STATE CWelsDecoder::DecodeFrameNoDelay (const unsigned char* kpSrc,
707
709
else {
708
710
ReleaseBufferedReadyPictureReorder (NULL , ppDst, pDstInfo);
709
711
}
710
- SET_EVENT (&m_sReleaseBufferEvent);
711
712
}
712
713
return (DECODING_STATE)iRet;
713
714
}
@@ -793,6 +794,10 @@ DECODING_STATE CWelsDecoder::DecodeFrame2WithCtx (PWelsDecoderContext pDecContex
793
794
pDecContext->iFrameNum = -1 ; // initialize
794
795
#endif
795
796
797
+ if (GetThreadCount (pDecContext) >= 1 ) {
798
+ WAIT_EVENT (&m_sReleaseBufferEvent, WELS_DEC_THREAD_WAIT_INFINITE);
799
+ }
800
+
796
801
pDecContext->iFeedbackTidInAu = -1 ; // initialize
797
802
pDecContext->iFeedbackNalRefIdc = -1 ; // initialize
798
803
if (pDstInfo) {
@@ -875,8 +880,6 @@ DECODING_STATE CWelsDecoder::DecodeFrame2WithCtx (PWelsDecoderContext pDecContex
875
880
876
881
OutputStatisticsLog (*pDecContext->pDecoderStatistics );
877
882
if (GetThreadCount (pDecContext) >= 1 ) {
878
- WAIT_EVENT (&m_sReleaseBufferEvent, WELS_DEC_THREAD_WAIT_INFINITE);
879
- RESET_EVENT (&m_sBufferingEvent);
880
883
BufferingReadyPicture (pDecContext, ppDst, pDstInfo);
881
884
SET_EVENT (&m_sBufferingEvent);
882
885
} else {
@@ -901,8 +904,6 @@ DECODING_STATE CWelsDecoder::DecodeFrame2WithCtx (PWelsDecoderContext pDecContex
901
904
pDecContext->dDecTime += (iEnd - iStart) / 1e3 ;
902
905
903
906
if (GetThreadCount (pDecContext) >= 1 ) {
904
- WAIT_EVENT (&m_sReleaseBufferEvent, WELS_DEC_THREAD_WAIT_INFINITE);
905
- RESET_EVENT (&m_sBufferingEvent);
906
907
BufferingReadyPicture (pDecContext, ppDst, pDstInfo);
907
908
SET_EVENT (&m_sBufferingEvent);
908
909
} else {
0 commit comments