Fix backward jump in timestamp if framerate increases in video processor tests.

Bug: none
Change-Id: Id905eb5ea546d5cf8a2fee70f3e262155e293f4e
Reviewed-on: https://webrtc-review.googlesource.com/43360
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21756}
This commit is contained in:
Åsa Persson
2018-01-24 17:20:18 +01:00
committed by Commit Bot
parent 191c39f307
commit 91af24a74b
2 changed files with 18 additions and 19 deletions

View File

@ -19,12 +19,10 @@
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/testsupport/mock/mock_frame_reader.h"
#include "test/testsupport/unittest_utils.h"
#include "test/video_codec_settings.h"
#include "typedefs.h" // NOLINT(build/include)
using ::testing::_;
using ::testing::ElementsAre;
using ::testing::Property;
using ::testing::Return;
@ -110,6 +108,7 @@ TEST_F(VideoProcessorTest, ProcessFrames_FixedFramerate) {
TEST_F(VideoProcessorTest, ProcessFrames_VariableFramerate) {
const int kBitrateKbps = 456;
const int kStartFramerateFps = 27;
const int kStartTimestamp = 90000 / kStartFramerateFps;
EXPECT_CALL(encoder_mock_, SetRateAllocation(_, kStartFramerateFps))
.Times(1)
.WillOnce(Return(0));
@ -117,9 +116,8 @@ TEST_F(VideoProcessorTest, ProcessFrames_VariableFramerate) {
EXPECT_CALL(frame_reader_mock_, ReadFrame())
.WillRepeatedly(Return(I420Buffer::Create(kWidth, kHeight)));
EXPECT_CALL(encoder_mock_, Encode(Property(&VideoFrame::timestamp,
1 * 90000 / kStartFramerateFps),
_, _))
EXPECT_CALL(encoder_mock_,
Encode(Property(&VideoFrame::timestamp, kStartTimestamp), _, _))
.Times(1);
video_processor_->ProcessFrame();
@ -129,9 +127,10 @@ TEST_F(VideoProcessorTest, ProcessFrames_VariableFramerate) {
.WillOnce(Return(0));
video_processor_->SetRates(kBitrateKbps, kNewFramerateFps);
EXPECT_CALL(encoder_mock_, Encode(Property(&VideoFrame::timestamp,
2 * 90000 / kNewFramerateFps),
_, _))
EXPECT_CALL(encoder_mock_,
Encode(Property(&VideoFrame::timestamp,
kStartTimestamp + 90000 / kNewFramerateFps),
_, _))
.Times(1);
video_processor_->ProcessFrame();