History

add protection for decoder and data format

huili2 committed 12 years ago

Commit f8d2ae41 parent 06e56ec4 files · +36 −17Browse files

Showing the changes to test/decoder/DecUT_DecExt.cpp (1 of 4 files). Show all

Unified · Split

test/decoder/DecUT_DecExt.cpp+10−3
@@ -86,7 +86,11 @@ void DecoderInterfaceTest::Init() { · 85 unmodified lines
8686 m_szBuffer[3] = 1;
8787 m_iBufLength = 4;
8888 CM_RETURN eRet = (CM_RETURN) m_pDec->Initialize (&m_sDecParam);
89− ASSERT_EQ (eRet, cmResultSuccess);
89+ if ((m_sDecParam.eOutputColorFormat != videoFormatI420) ||
90+ (m_sDecParam.eOutputColorFormat != videoFormatInternal))
91+ ASSERT_EQ (eRet, cmUnsupportedData);
92+ else
93+ ASSERT_EQ (eRet, cmResultSuccess);
9094 }
9195
9296 void DecoderInterfaceTest::Uninit() {
@@ -154,7 +158,7 @@ void DecoderInterfaceTest::TestInitUninit() { · 61 unmodified lines
154158 m_pDec->Initialize (&m_sDecParam);
155159 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_DATAFORMAT, &iOutput);
156160 EXPECT_EQ (eRet, cmResultSuccess);
157− EXPECT_EQ (20, iOutput);
161+ EXPECT_EQ ((int32_t) videoFormatI420, iOutput);
158162
159163 //Uninitialize, no GetOption can be done
160164 m_pDec->Uninitialize();
@@ -180,7 +184,10 @@ void DecoderInterfaceTest::TestDataFormat() { · 19 unmodified lines
180184
181185 //valid input
182186 eRet = (CM_RETURN) m_pDec->SetOption (DECODER_OPTION_DATAFORMAT, &iTmp);
183− EXPECT_EQ (eRet, cmResultSuccess);
187+ if ((iTmp != (int32_t) videoFormatI420) && (iTmp != (int32_t) videoFormatInternal))
188+ EXPECT_EQ (eRet, cmUnsupportedData);
189+ else
190+ EXPECT_EQ (eRet, cmResultSuccess);
184191 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_DATAFORMAT, &iOut);
185192 EXPECT_EQ (eRet, cmResultSuccess);
186193

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