Skip to content

fix(decoder): reject DECODER_OPTION_NUM_OF_THREADS after initialization - #3973

Open
HeaTTap wants to merge 1 commit into
cisco:masterfrom
HeaTTap:fix/decoder-thread-option-post-init
Open

fix(decoder): reject DECODER_OPTION_NUM_OF_THREADS after initialization#3973
HeaTTap wants to merge 1 commit into
cisco:masterfrom
HeaTTap:fix/decoder-thread-option-post-init

Conversation

@HeaTTap

@HeaTTap HeaTTap commented Jul 30, 2026

Copy link
Copy Markdown

Fixes #3969

When SetOption(DECODER_OPTION_NUM_OF_THREADS) is called after ISVCDecoder::Initialize(), resetting m_pDecThrCtx without re-creating worker threads leaves the decoder in an uninitialized thread context state, causing a deadlock in subsequent DecodeFrameNoDelay or WelsDestroyDecoder calls.

This fix returns cmInitParaError if DECODER_OPTION_NUM_OF_THREADS is set post-initialization (m_pDecThrCtx[0].pCtx != NULL), preventing thread context corruption.

Added unit test DecoderInitTest.SetThreadCountPostInitFails in test/api/decoder_test.cpp and verified full test suite passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decoder deadlocks when DECODER_OPTION_NUM_OF_THREADS is set after Initialize

1 participant