Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: webrtc/modules/video_coding/main/source/video_sender_unittest.cc

Issue 1426953003: Remove redudant encoder rate calls. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove redundant function Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/main/source/video_sender_unittest.cc
diff --git a/webrtc/modules/video_coding/main/source/video_sender_unittest.cc b/webrtc/modules/video_coding/main/source/video_sender_unittest.cc
index b1d645d12d772f5c05217b1768e958c713aa72bd..e9c8bd79b6d008266480df5eca1318e07acfec8c 100644
--- a/webrtc/modules/video_coding/main/source/video_sender_unittest.cc
+++ b/webrtc/modules/video_coding/main/source/video_sender_unittest.cc
@@ -318,7 +318,7 @@ TEST_F(TestVideoSenderWithMockEncoder, TestIntraRequestsInternalCapture) {
}
TEST_F(TestVideoSenderWithMockEncoder, EncoderFramerateUpdatedViaProcess) {
- sender_->SetChannelParameters(settings_.startBitrate, 0, 200);
+ sender_->SetChannelParameters(settings_.startBitrate * 1000, 0, 200);
const int64_t kRateStatsWindowMs = 2000;
const uint32_t kInputFps = 20;
int64_t start_time = clock_.TimeInMilliseconds();
@@ -331,6 +331,39 @@ TEST_F(TestVideoSenderWithMockEncoder, EncoderFramerateUpdatedViaProcess) {
AddFrame();
}
+TEST_F(TestVideoSenderWithMockEncoder,
+ NoRedundantSetChannelParameterOrSetRatesCalls) {
+ const uint8_t kLossRate = 4;
+ const uint8_t kRtt = 200;
+ const int64_t kRateStatsWindowMs = 2000;
+ const uint32_t kInputFps = 20;
+ int64_t start_time = clock_.TimeInMilliseconds();
+ // Expect initial call to SetChannelParameters. Rates are initialized through
+ // InitEncode and expects no additional call before the framerate (or bitrate)
+ // updates.
+ EXPECT_CALL(encoder_, SetChannelParameters(kLossRate, kRtt))
+ .Times(1)
+ .WillOnce(Return(0));
+ sender_->SetChannelParameters(settings_.startBitrate * 1000, kLossRate, kRtt);
+ while (clock_.TimeInMilliseconds() < start_time + kRateStatsWindowMs) {
+ AddFrame();
+ clock_.AdvanceTimeMilliseconds(1000 / kInputFps);
+ }
+ // After process, input framerate should be updated but not ChannelParameters
+ // as they are the same as before.
+ EXPECT_CALL(encoder_, SetRates(_, kInputFps)).Times(1).WillOnce(Return(0));
+ sender_->Process();
+ AddFrame();
+ // Call to SetChannelParameters with changed bitrate should call encoder
+ // SetRates but not encoder SetChannelParameters (that are unchanged).
+ EXPECT_CALL(encoder_, SetRates(2 * settings_.startBitrate, kInputFps))
+ .Times(1)
+ .WillOnce(Return(0));
+ sender_->SetChannelParameters(2 * settings_.startBitrate * 1000, kLossRate,
+ kRtt);
+ AddFrame();
+}
+
class TestVideoSenderWithVp8 : public TestVideoSender {
public:
TestVideoSenderWithVp8()
« no previous file with comments | « webrtc/modules/video_coding/main/source/video_sender.cc ('k') | webrtc/test/configurable_frame_size_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698