MCPcopy Create free account
hub / github.com/cisco/openh264 / TestParseOnlyAPI

Method TestParseOnlyAPI

test/decoder/DecUT_DecExt.cpp:258–336  ·  view source on GitHub ↗

Test parse only API

Source from the content-addressed store, hash-verified

256
257//Test parse only API
258void DecoderInterfaceTest::TestParseOnlyAPI() {
259 int iOutput;
260 int iRet;
261
262 m_pData[0] = m_pData[1] = m_pData[2] = NULL;
263 m_szBuffer[0] = m_szBuffer[1] = m_szBuffer[2] = 0;
264 m_szBuffer[3] = 1;
265 m_iBufLength = 4;
266 MockPacketType (NAL_UNIT_SPS, 12);
267
268 m_pDec->Uninitialize();
269
270 //test 1: bParseOnly = true; eEcActiveIdc = 0,1
271 for (int iNum = 0; iNum < 2; ++iNum) { //loop for EC
272 memset (&m_sBufferInfo, 0, sizeof (SBufferInfo));
273 memset (&m_sParserBsInfo, 0, sizeof (SParserBsInfo));
274 memset (&m_sDecParam, 0, sizeof (SDecodingParam));
275 m_sDecParam.pFileNameRestructed = NULL;
276 m_sDecParam.uiCpuLoad = rand() % 100;
277 m_sDecParam.uiTargetDqLayer = -1;
278 m_sDecParam.bParseOnly = true;
279 m_sDecParam.eEcActiveIdc = (ERROR_CON_IDC) iNum;
280 m_sDecParam.sVideoProperty.size = sizeof (SVideoProperty);
281 m_sDecParam.sVideoProperty.eVideoBsType = (VIDEO_BITSTREAM_TYPE) (rand() % 2);
282
283 iRet = m_pDec->Initialize (&m_sDecParam);
284 ASSERT_EQ (iRet, (int32_t) cmResultSuccess);
285 iRet = m_pDec->GetOption (DECODER_OPTION_ERROR_CON_IDC, &iOutput);
286 EXPECT_EQ (iRet, (int32_t) cmResultSuccess);
287 EXPECT_EQ (iOutput, (int32_t) ERROR_CON_DISABLE); //should be 0
288 //call DecodeParser(), correct call
289 iRet = (int32_t) m_pDec->DecodeParser (m_szBuffer, m_iBufLength, &m_sParserBsInfo);
290 EXPECT_EQ (iRet, (int32_t) dsNoParamSets);
291 iRet = m_pDec->GetOption (DECODER_OPTION_ERROR_CON_IDC, &iOutput);
292 EXPECT_EQ (iRet, (int32_t) cmResultSuccess);
293 EXPECT_EQ (iOutput, (int32_t) ERROR_CON_DISABLE); //should be 0
294 //call DecodeFrame2(), incorrect call
295 iRet = (int32_t) m_pDec->DecodeFrame2 (m_szBuffer, m_iBufLength, m_pData, &m_sBufferInfo);
296 EXPECT_EQ (iRet, (int32_t) dsInvalidArgument);
297 iRet = m_pDec->GetOption (DECODER_OPTION_ERROR_CON_IDC, &iOutput);
298 EXPECT_EQ (iRet, (int32_t) cmResultSuccess);
299 EXPECT_EQ (iOutput, (int32_t) ERROR_CON_DISABLE); //should be 0
300 m_pDec->Uninitialize();
301 }
302
303 //test 2: bParseOnly = false; eEcActiveIdc = 0,1
304 for (int iNum = 0; iNum < 2; ++iNum) { //loop for EC
305 memset (&m_sBufferInfo, 0, sizeof (SBufferInfo));
306 memset (&m_sParserBsInfo, 0, sizeof (SParserBsInfo));
307 memset (&m_sDecParam, 0, sizeof (SDecodingParam));
308 m_sDecParam.pFileNameRestructed = NULL;
309 m_sDecParam.uiCpuLoad = rand() % 100;
310 m_sDecParam.uiTargetDqLayer = -1;
311 m_sDecParam.bParseOnly = false;
312 m_sDecParam.eEcActiveIdc = (ERROR_CON_IDC) iNum;
313 m_sDecParam.sVideoProperty.size = sizeof (SVideoProperty);
314 m_sDecParam.sVideoProperty.eVideoBsType = (VIDEO_BITSTREAM_TYPE) (rand() % 2);
315

Callers

nothing calls this directly

Calls 5

UninitializeMethod · 0.45
InitializeMethod · 0.45
GetOptionMethod · 0.45
DecodeParserMethod · 0.45
DecodeFrame2Method · 0.45

Tested by

no test coverage detected