ref: 36abe317a588e3e0f927b149a005351bb82d3966
parent: 36d56b6638ee705d01fd30ec8e8e3099fbdc7ee7
author: ruil2 <[email protected]>
date: Mon Mar 17 07:56:19 EDT 2014
modify unit test for return type modification
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -512,7 +512,7 @@
}
const int32_t kiEncoderReturn = EncodeFrameInternal(kpSrcPic, pBsInfo);
-
+
switch (kiEncoderReturn) {
case ENC_RETURN_MEMALLOCERR:
WelsUninitEncoderExt (&m_pEncContext);
@@ -540,7 +540,6 @@
#ifdef DUMP_SRC_PICTURE
DumpSrcPicture (pSrc);
#endif // DUMP_SRC_PICTURE
-
return cmResultSuccess;
}
@@ -556,19 +555,13 @@
const int32_t kiEncoderReturn = WelsEncoderEncodeExt (m_pEncContext, pBsInfo, pSrcPic);
XMMREG_PROTECT_LOAD(CWelsH264SVCEncoder);
- switch (kiEncoderReturn) {
- case ENC_RETURN_MEMALLOCERR:
+ if(kiEncoderReturn == ENC_RETURN_MEMALLOCERR) {
WelsUninitEncoderExt (&m_pEncContext);
return videoFrameTypeInvalid;
- case ENC_RETURN_SUCCESS:
- case ENC_RETURN_CORRECTED:
- break;//continue processing
- case ENC_RETURN_UNSUPPORTED_PARA:
- case ENC_RETURN_UNEXPECTED:
+ }
+ else if((kiEncoderReturn != ENC_RETURN_SUCCESS)&&(kiEncoderReturn == ENC_RETURN_CORRECTED)){
+ WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from EncodeFrameInternal()!\n", kiEncoderReturn);
return videoFrameTypeInvalid;
- default:
- WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from WelsEncoderEncodeExt()!\n", kiEncoderReturn);
- return videoFrameTypeInvalid;
}
iFrameTypeReturned = pBsInfo->eOutputFrameType;
@@ -593,8 +586,6 @@
break;
}
-
-
///////////////////for test
#ifdef OUTPUT_BIT_STREAM
if (iFrameType != videoFrameTypeInvalid && iFrameType != videoFrameTypeSkip) {
@@ -642,7 +633,7 @@
DumpSrcPicture (pSrcPicList[0]->pData[0]);
#endif // DUMP_SRC_PICTURE
- return iFrameType;
+ return kiEncoderReturn;
}
--- a/test/BaseEncoderTest.cpp
+++ b/test/BaseEncoderTest.cpp
@@ -81,8 +81,8 @@
pic.pData[2] = pic.pData[1] + (width*height>>2);
while (in->read(buf.data(), frameSize) == frameSize) {
rv = encoder_->EncodeFrame(&pic, &info);
- ASSERT_TRUE(rv != videoFrameTypeInvalid);
- if (rv != videoFrameTypeSkip && cbk != NULL) {
+ ASSERT_TRUE(rv == cmResultSuccess);
+ if (info.eOutputFrameType != videoFrameTypeSkip && cbk != NULL) {
cbk->onEncodeFrame(info);
}
}