Skip to content

Commit a15af5e

Browse files
committed
Fix deadlock at the end of decoding.
For some h264 files, h264dec hangs at the end of decoding. This is regression caused by the commit 1c23887. This patch fixes the issue by adding SET_EVENT(&m_sReleaseBufferEvent) to SetOption( DECODER_OPTION_END_OF_STREAM) and CloseDecoderThreads().
1 parent 478e5ab commit a15af5e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

codec/decoder/plus/src/welsDecoderExt.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ void CWelsDecoder::OpenDecoderThreads() {
325325
}
326326
void CWelsDecoder::CloseDecoderThreads() {
327327
if (m_iThreadCount >= 1) {
328+
SET_EVENT (&m_sReleaseBufferEvent);
328329
for (int32_t i = 0; i < m_iThreadCount; i++) { //waiting the completion begun slices
329330
WAIT_SEMAPHORE (&m_pDecThrCtx[i].sThreadInfo.sIsIdle, WELS_DEC_THREAD_WAIT_INFINITE);
330331
m_pDecThrCtx[i].sThreadInfo.uiCommand = WELS_DEC_THREAD_COMMAND_ABORT;
@@ -513,6 +514,8 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) {
513514
if (pDecContext == NULL) return dsInitialOptExpected;
514515

515516
pDecContext->bEndOfStreamFlag = iVal ? true : false;
517+
if (iVal && m_iThreadCount >= 1)
518+
SET_EVENT (&m_sReleaseBufferEvent);
516519

517520
return cmResultSuccess;
518521
} else if (eOptID == DECODER_OPTION_ERROR_CON_IDC) { // Indicate error concealment status

0 commit comments

Comments
 (0)