Chromium Code Reviews| Index: webrtc/modules/video_coding/video_sender_unittest.cc |
| diff --git a/webrtc/modules/video_coding/video_sender_unittest.cc b/webrtc/modules/video_coding/video_sender_unittest.cc |
| index bda45521f62e15dd6bdd448a859d18cbb3ae076f..09fec49e883963fef734d93ca11ce2b95c2b19f2 100644 |
| --- a/webrtc/modules/video_coding/video_sender_unittest.cc |
| +++ b/webrtc/modules/video_coding/video_sender_unittest.cc |
| @@ -129,7 +129,7 @@ class EncodedImageCallbackImpl : public EncodedImageCallback { |
| private: |
| struct FrameData { |
| - FrameData() {} |
| + FrameData() : payload_size(0) {} |
| FrameData(size_t payload_size, const CodecSpecificInfo& codec_specific_info) |
| : payload_size(payload_size), |
| @@ -299,15 +299,38 @@ TEST_F(TestVideoSenderWithMockEncoder, TestIntraRequests) { |
| } |
| TEST_F(TestVideoSenderWithMockEncoder, TestSetRate) { |
| + // Let actual fps be half of max, so it can be distinguished from default. |
| + const int kActualFrameRate = settings_.maxFramerate / 2; |
| + const int kFrameIntervalMs = 1000 / kActualFrameRate; |
|
danilchap
2016/11/21 12:45:43
may be int64_t for consistency with other ms varia
sprang_webrtc
2016/11/21 13:01:21
Done.
|
| const uint32_t new_bitrate_kbps = settings_.startBitrate + 300; |
| + |
| + // Initial frame rate is taken from config, as we have no data yet. |
| BitrateAllocation new_rate_allocation = rate_allocator_->GetAllocation( |
| new_bitrate_kbps * 1000, settings_.maxFramerate); |
| - EXPECT_CALL(encoder_, SetRateAllocation(new_rate_allocation, _)) |
| + EXPECT_CALL(encoder_, |
| + SetRateAllocation(new_rate_allocation, settings_.maxFramerate)) |
| .Times(1) |
| .WillOnce(Return(0)); |
| sender_->SetChannelParameters(new_bitrate_kbps * 1000, 0, 200, |
| rate_allocator_.get()); |
| AddFrame(); |
| + clock_.AdvanceTimeMilliseconds(kFrameIntervalMs); |
| + |
| + // Add enough frames so that input frame rate will be updated. |
| + const int kFramesToSend = |
| + (VCMProcessTimer::kDefaultProcessIntervalMs / kActualFrameRate) + 1; |
|
danilchap
2016/11/21 12:45:42
(/kFramesIntervalMs) or (*kActualFrameRate/1000)
i
sprang_webrtc
2016/11/21 13:01:21
Oops, kFrameIntervalMs was what I intended to put
|
| + for (int i = 0; i < kFramesToSend; ++i) { |
| + AddFrame(); |
| + clock_.AdvanceTimeMilliseconds(kFrameIntervalMs); |
| + } |
| + |
| + EXPECT_CALL(encoder_, |
| + SetRateAllocation(new_rate_allocation, kActualFrameRate)) |
| + .Times(1) |
| + .WillOnce(Return(0)); |
| + |
| + sender_->Process(); |
| + AddFrame(); |
| // Expect no call to encoder_.SetRates if the new bitrate is zero. |
| EXPECT_CALL(encoder_, SetRateAllocation(_, _)).Times(0); |