ref: 7c868cab4d6f962f7e0c6440e5151cb24253dec4
parent: 55a5272f685a9c4a3725ff550e4faac4c3ca56a5
parent: 61b82d28c40db5de9ba0780daec24c82bf8d34dc
author: huili2 <huili2@cisco.com>
date: Wed May 6 09:43:50 EDT 2015
Merge pull request #1931 from HaiboZhu/Bug_Fix_EncoderInterface_OptionSetTest Bug fix for encoder interface UT
--- a/test/encoder/EncUT_EncoderExt.cpp
+++ b/test/encoder/EncUT_EncoderExt.cpp
@@ -150,7 +150,7 @@
TEST_F (EncoderInterfaceTest, EncoderOptionSetTest) {
int iResult, iValue, iReturn;
- float fValue, fReturn;
+ float fFrameRate, fReturn;
int uiTraceLevel = WELS_LOG_QUIET;
pPtrEnc->SetOption (ENCODER_OPTION_TRACE_LEVEL, &uiTraceLevel);
@@ -195,10 +195,10 @@
pSrcPic->uiTimeStamp += 30;
eOptionId = ENCODER_OPTION_FRAME_RATE;
- fValue = static_cast<float> (rand() % 100 - 5);
- iResult = pPtrEnc->SetOption (eOptionId, &fValue);
+ fFrameRate = static_cast<float> (rand() % 100 - 5);
+ iResult = pPtrEnc->SetOption (eOptionId, &fFrameRate);
- if (fValue <= 0)
+ if (fFrameRate <= 0)
EXPECT_EQ (iResult, static_cast<int> (cmInitParaError));
else {
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
@@ -205,7 +205,7 @@
iResult = pPtrEnc->GetOption (eOptionId, &fReturn);
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
- EXPECT_EQ (WELS_CLIP3 (fValue, 1, 60), fReturn);
+ EXPECT_EQ (WELS_CLIP3 (fFrameRate, 1, 60), fReturn);
}
PrepareOneSrcFrame();
iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);
@@ -240,7 +240,7 @@
sInfo.iLayer = SPATIAL_LAYER_0;
iResult = pPtrEnc->SetOption (eOptionId, &sInfo);
pPtrEnc->GetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParamExt);
- if (sInfo.iBitrate <= 0)
+ if (sInfo.iBitrate <= 0 || pParamExt->sSpatialLayers[sInfo.iLayer].iSpatialBitrate <= (int) (fFrameRate + 0.5f))
EXPECT_EQ (iResult, static_cast<int> (cmInitParaError));
else if (pParamExt->sSpatialLayers[sInfo.iLayer].iSpatialBitrate >
pParamExt->sSpatialLayers[sInfo.iLayer].iMaxSpatialBitrate) {