Showing the changes to test/decoder/DecUT_DecExt.cpp (1 of 11 files). Show all
Unified · Split
| @@ -26,6 +26,8 @@ class DecoderInterfaceTest : public ::testing::Test { · 25 unmodified lines | ||
| 26 | 26 | } |
| 27 | 27 | //Init members |
| 28 | 28 | void Init(); |
| 29 | + //Init valid members | |
| 30 | + void ValidInit(); | |
| 29 | 31 | //Uninit members |
| 30 | 32 | void Uninit(); |
| 31 | 33 | //Mock input data for test |
| @@ -94,6 +96,24 @@ void DecoderInterfaceTest::Init() { · 62 unmodified lines | ||
| 94 | 96 | ASSERT_EQ (eRet, cmResultSuccess); |
| 95 | 97 | } |
| 96 | 98 | |
| 99 | +void DecoderInterfaceTest::ValidInit() { | |
| 100 | + memset (&m_sBufferInfo, 0, sizeof (SBufferInfo)); | |
| 101 | + memset (&m_sDecParam, 0, sizeof (SDecodingParam)); | |
| 102 | + m_sDecParam.pFileNameRestructed = NULL; | |
| 103 | + m_sDecParam.uiCpuLoad = 1; | |
| 104 | + m_sDecParam.uiTargetDqLayer = 1; | |
| 105 | + m_sDecParam.eEcActiveIdc = (ERROR_CON_IDC) (rand() & 7); | |
| 106 | + m_sDecParam.sVideoProperty.size = sizeof (SVideoProperty); | |
| 107 | + m_sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT; | |
| 108 | + | |
| 109 | + m_pData[0] = m_pData[1] = m_pData[2] = NULL; | |
| 110 | + m_szBuffer[0] = m_szBuffer[1] = m_szBuffer[2] = 0; | |
| 111 | + m_szBuffer[3] = 1; | |
| 112 | + m_iBufLength = 4; | |
| 113 | + CM_RETURN eRet = (CM_RETURN) m_pDec->Initialize (&m_sDecParam); | |
| 114 | + ASSERT_EQ (eRet, cmResultSuccess); | |
| 115 | +} | |
| 116 | + | |
| 97 | 117 | void DecoderInterfaceTest::Uninit() { |
| 98 | 118 | if (m_pDec) { |
| 99 | 119 | CM_RETURN eRet = (CM_RETURN) m_pDec->Uninitialize(); |
| @@ -310,7 +330,7 @@ void DecoderInterfaceTest::TestEndOfStream() { · 210 unmodified lines | ||
| 310 | 330 | int iTmp, iOut; |
| 311 | 331 | CM_RETURN eRet; |
| 312 | 332 | |
| 313 | − Init(); | |
| 333 | + ValidInit(); | |
| 314 | 334 | |
| 315 | 335 | //invalid input |
| 316 | 336 | eRet = (CM_RETURN) m_pDec->SetOption (DECODER_OPTION_END_OF_STREAM, NULL); |
| @@ -372,7 +392,7 @@ void DecoderInterfaceTest::TestVclNal() { · 55 unmodified lines | ||
| 372 | 392 | int iTmp, iOut; |
| 373 | 393 | CM_RETURN eRet; |
| 374 | 394 | |
| 375 | − Init(); | |
| 395 | + ValidInit(); | |
| 376 | 396 | |
| 377 | 397 | //Test SetOption |
| 378 | 398 | //VclNal never supports SetOption |
| @@ -481,7 +501,7 @@ void DecoderInterfaceTest::TestGetDecStatistics() { · 102 unmodified lines | ||
| 481 | 501 | SDecoderStatistics sDecStatic; |
| 482 | 502 | int32_t iError = 0; |
| 483 | 503 | |
| 484 | − Init(); | |
| 504 | + ValidInit(); | |
| 485 | 505 | // setoption not support, |
| 486 | 506 | eRet = (CM_RETURN)m_pDec->SetOption (DECODER_OPTION_GET_STATISTICS, NULL); |
| 487 | 507 | EXPECT_EQ (eRet, cmInitParaError); |
| @@ -504,7 +524,7 @@ void DecoderInterfaceTest::TestGetDecStatistics() { · 16 unmodified lines | ||
| 504 | 524 | Uninit(); |
| 505 | 525 | |
| 506 | 526 | //Decoder error bs when the first IDR lost |
| 507 | − Init(); | |
| 527 | + ValidInit(); | |
| 508 | 528 | iError = 2; |
| 509 | 529 | m_pDec->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iError); |
| 510 | 530 | DecoderBs ("res/BA_MW_D_IDR_LOST.264"); |
| @@ -522,7 +542,7 @@ void DecoderInterfaceTest::TestGetDecStatistics() { · 11 unmodified lines | ||
| 522 | 542 | Uninit(); |
| 523 | 543 | |
| 524 | 544 | //ecoder error bs when the first P lost |
| 525 | − Init(); | |
| 545 | + ValidInit(); | |
| 526 | 546 | iError = 2; |
| 527 | 547 | m_pDec->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iError); |
| 528 | 548 | |
| @@ -543,7 +563,7 @@ void DecoderInterfaceTest::TestGetDecStatistics() { · 14 unmodified lines | ||
| 543 | 563 | //EC enable |
| 544 | 564 | |
| 545 | 565 | //EC Off UT just correc bitstream |
| 546 | − Init(); | |
| 566 | + ValidInit(); | |
| 547 | 567 | iError = 0; |
| 548 | 568 | m_pDec->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iError); |
| 549 | 569 | DecoderBs ("res/test_vd_1d.264"); |