ref: 47e3f4c45c1bc7903768608283456a92659f7663
parent: d11f12db54682e80a48d352a96577e3a34b162cc
author: sijchen <sijchen@cisco.com>
date: Tue Jan 19 12:16:39 EST 2016
correct and enhance the ut template
--- a/test/api/encode_decode_api_test.template
+++ b/test/api/encode_decode_api_test.template
@@ -21,8 +21,10 @@
//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 @@
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 @@
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
rv = decoder[iIdx]->Initialize (&decParam);
- ASSERT_EQ (0, rv);
+ EXPECT_TRUE (0 == rv);
}
@@ -64,9 +66,15 @@
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 @@
} 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 @@
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;
}
}
}