From 47e3f4c45c1bc7903768608283456a92659f7663 Mon Sep 17 00:00:00 2001 From: sijchen Date: Tue, 19 Jan 2016 17:16:39 -0800 Subject: [PATCH] correct and enhance the ut template --- test/api/encode_decode_api_test.template | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/test/api/encode_decode_api_test.template b/test/api/encode_decode_api_test.template index 18f16f46..e99f979f 100644 --- a/test/api/encode_decode_api_test.template +++ b/test/api/encode_decode_api_test.template @@ -21,8 +21,10 @@ TEST_F (EncodeDecodeTestAPI, LogEncoding) { //int iEncFrameNum = $TOTAL_FRMS; //FillFirstParam - int rv = encoder_->InitializeExt (¶m_); - ASSERT_TRUE (rv == cmResultSuccess); + int iTraceLevel = WELS_LOG_INFO; + int rv = encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel); + rv = encoder_->InitializeExt (¶m_); + EXPECT_TRUE (rv == cmResultSuccess); unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM]; int aLen[MAX_SPATIAL_LAYER_NUM] = {0}; @@ -45,7 +47,7 @@ TEST_F (EncodeDecodeTestAPI, LogEncoding) { aLen[iIdx] = 0; long rv = WelsCreateDecoder (&decoder[iIdx]); - ASSERT_EQ (0, rv); + EXPECT_TRUE (0 == rv); EXPECT_TRUE (decoder[iIdx] != NULL); SDecodingParam decParam; @@ -55,7 +57,7 @@ TEST_F (EncodeDecodeTestAPI, LogEncoding) { decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT; rv = decoder[iIdx]->Initialize (&decParam); - ASSERT_EQ (0, rv); + EXPECT_TRUE (0 == rv); } @@ -64,9 +66,15 @@ TEST_F (EncodeDecodeTestAPI, LogEncoding) { int iLayerLen = 0; unsigned char* pData[3] = { NULL }; + if (iFrame % 10 == 0) { + printf("current iFrame=%d\n", iFrame); + } + //FillParam InitialEncDec (param_.iPicWidth, param_.iPicHeight); + rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, ¶m_); + ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed pParam: rv = " << rv; EncodeOneFrame (0); // init @@ -93,7 +101,7 @@ TEST_F (EncodeDecodeTestAPI, LogEncoding) { } else { if (layerInfo.uiLayerType == NON_VIDEO_CODING_LAYER) { // under SimulcastSVC, need to copy non-VCL to all layers - for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) { + for (iIdx = 0; iIdx < param_.iSpatialLayerNum; iIdx++) { memcpy ((pBsBuf[iIdx] + aLen[iIdx]), layerInfo.pBsBuf, iLayerLen * sizeof (unsigned char)); aLen[iIdx] += iLayerLen; } @@ -115,11 +123,11 @@ TEST_F (EncodeDecodeTestAPI, LogEncoding) { fwrite (pBsBuf[iIdx], aLen[iIdx], 1, fEnc[iIdx]); #endif iResult = decoder[iIdx]->DecodeFrame2 (pBsBuf[iIdx], aLen[iIdx], pData, &dstBufInfo_); - EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << "LayerIdx=" << iIdx; + EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << " iFrame = " << iFrame << " LayerIdx=" << iIdx; iResult = decoder[iIdx]->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); - EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << "LayerIdx=" << iIdx; - EXPECT_EQ (dstBufInfo_.iBufferStatus, 1) << "LayerIdx=" << iIdx; + EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << " iFrame = " << iFrame << " LayerIdx=" << iIdx; + EXPECT_EQ (dstBufInfo_.iBufferStatus, 1) << "LayerIdx=" << iIdx << " LayerLen=" << aLen[iIdx] << " iFrame = " << iFrame; } } }