Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions codec/decoder/plus/src/welsDecoderExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,11 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) {
threadCount = 3;
}
if (threadCount != m_iThreadCount) {
if (m_pDecThrCtx != NULL && m_pDecThrCtx[0].pCtx != NULL) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
"CWelsDecoder::SetOption(): DECODER_OPTION_NUM_OF_THREADS cannot be changed after decoder is initialized.");
return cmInitParaError;
}
m_iThreadCount = threadCount;
if (m_pDecThrCtx != NULL) {
delete [] m_pDecThrCtx;
Expand Down
6 changes: 6 additions & 0 deletions test/api/decoder_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ class DecoderInitTest : public ::testing::Test, public BaseDecoderTest {

TEST_F (DecoderInitTest, JustInit) {}

TEST_F (DecoderInitTest, SetThreadCountPostInitFails) {
int iThreadCount = 2;
long rv = decoder_->SetOption (DECODER_OPTION_NUM_OF_THREADS, &iThreadCount);
EXPECT_NE (0, rv);
}

struct FileParam {
const char* fileName;
const char* hashStr;
Expand Down