History

enable api test for decoder VclNal

huili2 committed 12 years ago

Commit f82726d1 parent 49f8fe84 files · +185 −13Browse files

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

Unified · Split

test/decoder/DecUT_DecExt.cpp+52−12
@@ -145,8 +145,10 @@ void DecoderInterfaceTest::TestInitUninit() { · 144 unmodified lines
145145 CM_RETURN eRet;
146146 //No initialize, no GetOption can be done
147147 m_pDec->Uninitialize();
148− eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_DATAFORMAT, &iOutput);
149− EXPECT_EQ (eRet, cmInitExpected);
148+ for (int i = 0; i <= (int) DECODER_OPTION_TRACE_CALLBACK_CONTEXT; ++i) {
149+ eRet = (CM_RETURN) m_pDec->GetOption ((DECODER_OPTION) i, &iOutput);
150+ EXPECT_EQ (eRet, cmInitExpected);
151+ }
150152 //Initialize first, can get input color format
151153 m_sDecParam.eOutputColorFormat = (EVideoFormatType) 20; //just for test
152154 m_pDec->Initialize (&m_sDecParam);
@@ -157,9 +159,11 @@ void DecoderInterfaceTest::TestInitUninit() { · 4 unmodified lines
157159 //Uninitialize, no GetOption can be done
158160 m_pDec->Uninitialize();
159161 iOutput = 21;
160− eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_DATAFORMAT, &iOutput);
161− EXPECT_EQ (iOutput, 21);
162− EXPECT_EQ (eRet, cmInitExpected);
162+ for (int i = 0; i <= (int) DECODER_OPTION_TRACE_CALLBACK_CONTEXT; ++i) {
163+ eRet = (CM_RETURN) m_pDec->GetOption ((DECODER_OPTION) i, &iOutput);
164+ EXPECT_EQ (iOutput, 21);
165+ EXPECT_EQ (eRet, cmInitExpected);
166+ }
163167 }
164168
165169 //DECODER_OPTION_DATAFORMAT
@@ -168,6 +172,8 @@ void DecoderInterfaceTest::TestDataFormat() { · 2 unmodified lines
168172 int iOut;
169173 CM_RETURN eRet;
170174
175+ Init();
176+
171177 //invalid input
172178 eRet = (CM_RETURN) m_pDec->SetOption (DECODER_OPTION_DATAFORMAT, NULL);
173179 EXPECT_EQ (eRet, cmInitParaError);
@@ -179,6 +185,8 @@ void DecoderInterfaceTest::TestDataFormat() { · 5 unmodified lines
179185 EXPECT_EQ (eRet, cmResultSuccess);
180186
181187 EXPECT_EQ (iOut, (int32_t) videoFormatI420);
188+
189+ Uninit();
182190 }
183191
184192 //DECODER_OPTION_END_OF_STREAM
@@ -186,6 +194,8 @@ void DecoderInterfaceTest::TestEndOfStream() { · 1 unmodified line
186194 int iTmp, iOut;
187195 CM_RETURN eRet;
188196
197+ Init();
198+
189199 //invalid input
190200 eRet = (CM_RETURN) m_pDec->SetOption (DECODER_OPTION_END_OF_STREAM, NULL);
191201 EXPECT_EQ (eRet, cmInitParaError);
@@ -234,12 +244,48 @@ void DecoderInterfaceTest::TestEndOfStream() { · 42 unmodified lines
234244 eRet = (CM_RETURN) m_pDec->DecodeFrame2 (NULL, 0, m_pData, &m_sBufferInfo);
235245 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
236246 EXPECT_EQ (iOut, true); //decoder should have EOS == true
247+
248+ Uninit();
237249 }
238250
239251
240252 //DECODER_OPTION_VCL_NAL
253+//Here Test illegal bitstream input
254+//legal bitstream decoding test, please see api test
241255 void DecoderInterfaceTest::TestVclNal() {
242− //TODO
256+ int iTmp, iOut;
257+ CM_RETURN eRet;
258+
259+ Init();
260+
261+ //Test SetOption
262+ //VclNal never supports SetOption
263+ iTmp = rand();
264+ eRet = (CM_RETURN) m_pDec->SetOption (DECODER_OPTION_VCL_NAL, &iTmp);
265+ EXPECT_EQ (eRet, cmInitParaError);
266+
267+ //Test GetOption
268+ //invalid input
269+ eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_VCL_NAL, NULL);
270+ EXPECT_EQ (eRet, cmInitParaError);
271+
272+ //valid input without actual decoding
273+ eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_VCL_NAL, &iOut);
274+ EXPECT_EQ (eRet, cmResultSuccess);
275+ EXPECT_EQ (iOut, FEEDBACK_NON_VCL_NAL);
276+
277+ //valid input with decoding error
278+ MockPacketType (NAL_UNIT_CODED_SLICE_IDR, 50);
279+ m_pDec->DecodeFrame2 (m_szBuffer, m_iBufLength, m_pData, &m_sBufferInfo);
280+ eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_VCL_NAL, &iOut);
281+ EXPECT_EQ (eRet, cmResultSuccess);
282+ EXPECT_EQ (iOut, FEEDBACK_UNKNOWN_NAL);
283+ m_pDec->DecodeFrame2 (NULL, 0, m_pData, &m_sBufferInfo);
284+ eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_VCL_NAL, &iOut);
285+ EXPECT_EQ (eRet, cmResultSuccess);
286+ EXPECT_EQ (iOut, FEEDBACK_UNKNOWN_NAL);
287+
288+ Uninit();
243289 }
244290
245291 //DECODER_OPTION_TEMPORAL_ID
@@ -293,9 +339,6 @@ TEST_F (DecoderInterfaceTest, DecoderInterfaceAll) { · 47 unmodified lines
293339
294340 //Initialize Uninitialize
295341 TestInitUninit();
296−
297− //AfterInitialize is OK, do the following tests
298− Init();
299342 //DECODER_OPTION_DATAFORMAT
300343 TestDataFormat();
301344 //DECODER_OPTION_END_OF_STREAM
@@ -320,9 +363,6 @@ TEST_F (DecoderInterfaceTest, DecoderInterfaceAll) { · 18 unmodified lines
320363 TestTraceCallback();
321364 //DECODER_OPTION_TRACE_CALLBACK_CONTEXT
322365 TestTraceCallbackContext();
323−
324− //uninitialize
325− Uninit();
326366 }
327367
328368

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