From 65439007477c33b974c447601728888d8f22047e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 25 Jul 2014 20:13:29 +0300 Subject: [PATCH] Don't set iPicWidth or iPicHeight to 0 in random tests This should fix occasional failures in the EncoderInterfaceTests, such as in https://travis-ci.org/cisco/openh264/jobs/30815104. --- test/encoder/EncUT_EncoderExt.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/encoder/EncUT_EncoderExt.cpp b/test/encoder/EncUT_EncoderExt.cpp index 1d597e39..3108fe46 100644 --- a/test/encoder/EncUT_EncoderExt.cpp +++ b/test/encoder/EncUT_EncoderExt.cpp @@ -316,8 +316,8 @@ TEST_F (EncoderInterfaceTest, MemoryCheckTest) { void GetValidEncParamBase (SEncParamBase* pEncParamBase) { pEncParamBase->iUsageType = CAMERA_VIDEO_REAL_TIME; - pEncParamBase->iPicWidth = ((rand() * 2) % (MAX_WIDTH)); - pEncParamBase->iPicHeight = ((rand() * 2) % (MAX_HEIGHT)); + pEncParamBase->iPicWidth = 2 + ((rand() * 2) % (MAX_WIDTH - 2)); + pEncParamBase->iPicHeight = 2 + ((rand() * 2) % (MAX_HEIGHT - 2)); pEncParamBase->iPicWidth = VALID_SIZE(pEncParamBase->iPicWidth); pEncParamBase->iPicHeight = VALID_SIZE(pEncParamBase->iPicHeight); pEncParamBase->iTargetBitrate = rand() + 1; //!=0 @@ -470,8 +470,8 @@ TEST_F (EncoderInterfaceTest, ForceIntraFrameWithTemporal) { SEncParamExt sEncParamExt; pPtrEnc->GetDefaultParams (&sEncParamExt); sEncParamExt.iUsageType = CAMERA_VIDEO_REAL_TIME; - sEncParamExt.iPicWidth = abs ((rand() * 2) + MB_SIZE) % (MAX_WIDTH + 1); - sEncParamExt.iPicHeight = abs ((rand() * 2) + MB_SIZE) % (MAX_HEIGHT + 1); + sEncParamExt.iPicWidth = MB_SIZE + abs ((rand() * 2) % (MAX_WIDTH - MB_SIZE)); + sEncParamExt.iPicHeight = MB_SIZE + abs ((rand() * 2) % (MAX_HEIGHT - MB_SIZE)); sEncParamExt.iTargetBitrate = rand() + 1; //!=0 sEncParamExt.iRCMode = RC_BITRATE_MODE; //-1, 0, 1, 2 sEncParamExt.fMaxFrameRate = rand() + 0.5f; //!=0 @@ -550,4 +550,4 @@ TEST_F (EncoderInterfaceTest, EncodeParameterSets) { TEST_F (EncoderInterfaceTest, BasicReturnTypeTest) { //TODO -} \ No newline at end of file +}