[Encoder] fix a calculation of fAverageFrameRate
Showing the changes to test/encoder/EncUT_EncoderExt.cpp (1 of 2 files). Show all
Unified · Split
| @@ -124,6 +124,7 @@ void EncoderInterfaceTest::EncodeOneIDRandP (ISVCEncoder* pPtrEnc) { · 123 unmodified lines | |||
| 124 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | 124 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 125 | //EXPECT_EQ (sFbi.eFrameType, static_cast<int> (videoFrameTypeIDR)); | 125 | //EXPECT_EQ (sFbi.eFrameType, static_cast<int> (videoFrameTypeIDR)); |
| 126 | 126 | ||
| 127 | pSrcPic->uiTimeStamp += 30; | ||
| 127 | iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi); | 128 | iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi); |
| 128 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | 129 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 129 | } | 130 | } |
| @@ -686,6 +687,7 @@ void EncoderInterfaceTest::ChangeResolutionAndCheckStatistics (const SEncParamBa · 556 unmodified lines | |||
| 686 | 687 | ||
| 687 | // 3, code one frame | 688 | // 3, code one frame |
| 688 | PrepareOneSrcFrame(); | 689 | PrepareOneSrcFrame(); |
| 690 | pSrcPic->uiTimeStamp = 30 * pEncoderStatistics->uiInputFrameCount; | ||
| 689 | iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi); | 691 | iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi); |
| 690 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | 692 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 691 | iResult = pPtrEnc->GetOption (ENCODER_OPTION_GET_STATISTICS, pEncoderStatistics); | 693 | iResult = pPtrEnc->GetOption (ENCODER_OPTION_GET_STATISTICS, pEncoderStatistics); |
| @@ -737,6 +739,14 @@ TEST_F (EncoderInterfaceTest, GetStatistics) { · 45 unmodified lines | |||
| 737 | sEncParamBase.iPicHeight = (sEncParamBase.iPicHeight % 16) + 1; //try 1~16 | 739 | sEncParamBase.iPicHeight = (sEncParamBase.iPicHeight % 16) + 1; //try 1~16 |
| 738 | ChangeResolutionAndCheckStatistics (sEncParamBase, &sEncoderStatistics); | 740 | ChangeResolutionAndCheckStatistics (sEncParamBase, &sEncoderStatistics); |
| 739 | 741 | ||
| 742 | // try timestamp and frame rate | ||
| 743 | pSrcPic->uiTimeStamp = 1000; | ||
| 744 | iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi); | ||
| 745 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | ||
| 746 | iResult = pPtrEnc->GetOption (ENCODER_OPTION_GET_STATISTICS, &sEncoderStatistics); | ||
| 747 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | ||
| 748 | EXPECT_EQ (static_cast<int> (sEncoderStatistics.fAverageFrameRate), sEncoderStatistics.uiInputFrameCount); | ||
| 749 | |||
| 740 | // 4, change log interval | 750 | // 4, change log interval |
| 741 | int32_t iInterval = 0; | 751 | int32_t iInterval = 0; |
| 742 | iResult = pPtrEnc->GetOption (ENCODER_OPTION_STATISTICS_LOG_INTERVAL, &iInterval); | 752 | iResult = pPtrEnc->GetOption (ENCODER_OPTION_STATISTICS_LOG_INTERVAL, &iInterval); |