modify unit test for return type modification

This commit is contained in:
ruil2 2014-03-17 11:56:19 +08:00
parent 36d56b6638
commit 36abe317a5
2 changed files with 8 additions and 17 deletions

View File

@ -512,7 +512,7 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSIn
} }
const int32_t kiEncoderReturn = EncodeFrameInternal(kpSrcPic, pBsInfo); const int32_t kiEncoderReturn = EncodeFrameInternal(kpSrcPic, pBsInfo);
switch (kiEncoderReturn) { switch (kiEncoderReturn) {
case ENC_RETURN_MEMALLOCERR: case ENC_RETURN_MEMALLOCERR:
WelsUninitEncoderExt (&m_pEncContext); WelsUninitEncoderExt (&m_pEncContext);
@ -540,7 +540,6 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSIn
#ifdef DUMP_SRC_PICTURE #ifdef DUMP_SRC_PICTURE
DumpSrcPicture (pSrc); DumpSrcPicture (pSrc);
#endif // DUMP_SRC_PICTURE #endif // DUMP_SRC_PICTURE
return cmResultSuccess; return cmResultSuccess;
} }
@ -556,18 +555,12 @@ int CWelsH264SVCEncoder::EncodeFrameInternal(const SSourcePicture* pSrcPic, SFr
const int32_t kiEncoderReturn = WelsEncoderEncodeExt (m_pEncContext, pBsInfo, pSrcPic); const int32_t kiEncoderReturn = WelsEncoderEncodeExt (m_pEncContext, pBsInfo, pSrcPic);
XMMREG_PROTECT_LOAD(CWelsH264SVCEncoder); XMMREG_PROTECT_LOAD(CWelsH264SVCEncoder);
switch (kiEncoderReturn) { if(kiEncoderReturn == ENC_RETURN_MEMALLOCERR) {
case ENC_RETURN_MEMALLOCERR:
WelsUninitEncoderExt (&m_pEncContext); WelsUninitEncoderExt (&m_pEncContext);
return videoFrameTypeInvalid; return videoFrameTypeInvalid;
case ENC_RETURN_SUCCESS: }
case ENC_RETURN_CORRECTED: else if((kiEncoderReturn != ENC_RETURN_SUCCESS)&&(kiEncoderReturn == ENC_RETURN_CORRECTED)){
break;//continue processing WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from EncodeFrameInternal()!\n", kiEncoderReturn);
case ENC_RETURN_UNSUPPORTED_PARA:
case ENC_RETURN_UNEXPECTED:
return videoFrameTypeInvalid;
default:
WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from WelsEncoderEncodeExt()!\n", kiEncoderReturn);
return videoFrameTypeInvalid; return videoFrameTypeInvalid;
} }
@ -593,8 +586,6 @@ int CWelsH264SVCEncoder::EncodeFrameInternal(const SSourcePicture* pSrcPic, SFr
break; break;
} }
///////////////////for test ///////////////////for test
#ifdef OUTPUT_BIT_STREAM #ifdef OUTPUT_BIT_STREAM
if (iFrameType != videoFrameTypeInvalid && iFrameType != videoFrameTypeSkip) { if (iFrameType != videoFrameTypeInvalid && iFrameType != videoFrameTypeSkip) {
@ -642,7 +633,7 @@ int CWelsH264SVCEncoder::EncodeFrameInternal(const SSourcePicture* pSrcPic, SFr
DumpSrcPicture (pSrcPicList[0]->pData[0]); DumpSrcPicture (pSrcPicList[0]->pData[0]);
#endif // DUMP_SRC_PICTURE #endif // DUMP_SRC_PICTURE
return iFrameType; return kiEncoderReturn;
} }

View File

@ -81,8 +81,8 @@ void BaseEncoderTest::EncodeStream(InputStream* in, int width, int height,
pic.pData[2] = pic.pData[1] + (width*height>>2); pic.pData[2] = pic.pData[1] + (width*height>>2);
while (in->read(buf.data(), frameSize) == frameSize) { while (in->read(buf.data(), frameSize) == frameSize) {
rv = encoder_->EncodeFrame(&pic, &info); rv = encoder_->EncodeFrame(&pic, &info);
ASSERT_TRUE(rv != videoFrameTypeInvalid); ASSERT_TRUE(rv == cmResultSuccess);
if (rv != videoFrameTypeSkip && cbk != NULL) { if (info.eOutputFrameType != videoFrameTypeSkip && cbk != NULL) {
cbk->onEncodeFrame(info); cbk->onEncodeFrame(info);
} }
} }