Index: webrtc/video/video_send_stream_tests.cc |
diff --git a/webrtc/video/video_send_stream_tests.cc b/webrtc/video/video_send_stream_tests.cc |
index cc76b13515a54c33a7dce5667c03691b28f8b40b..9668a146ff5745bcb23082e52ff5bdaab86c91fe 100644 |
--- a/webrtc/video/video_send_stream_tests.cc |
+++ b/webrtc/video/video_send_stream_tests.cc |
@@ -36,6 +36,7 @@ |
#include "webrtc/test/null_transport.h" |
#include "webrtc/test/rtcp_packet_parser.h" |
#include "webrtc/test/testsupport/perf_test.h" |
+#include "webrtc/test/field_trial.h" |
#include "webrtc/video/send_statistics_proxy.h" |
#include "webrtc/video/transport_adapter.h" |
@@ -3174,4 +3175,67 @@ TEST_F(VideoSendStreamTest, |
TestRequestSourceRotateVideo(true); |
} |
+// This test verifies that overhead is removed from the bandwidth estimate by |
+// testing that the maximum possible target payload rate is smaller than the |
+// maximum bandwidth estimate by the overhead rate." |
minyue-webrtc
2016/11/24 15:45:46
remove "
michaelt
2016/11/24 16:29:21
Done.
|
+TEST_F(VideoSendStreamTest, RemoveOverheadFromBandwidth) { |
+ class RemoveOverheadFromBandwidthTest : public test::EndToEndTest, |
+ public test::FakeEncoder { |
+ public: |
+ RemoveOverheadFromBandwidthTest() |
+ : EndToEndTest(test::CallTest::kDefaultTimeoutMs), |
+ FakeEncoder(Clock::GetRealTimeClock()), |
+ call_(nullptr), |
+ max_bitrate_kbps_(0) {} |
+ |
+ int32_t SetRateAllocation(const BitrateAllocation& bitrate, |
+ uint32_t frameRate) override { |
+ if (max_bitrate_kbps_ < bitrate.get_sum_kbps()) |
+ max_bitrate_kbps_ = bitrate.get_sum_kbps(); |
+ return FakeEncoder::SetRateAllocation(bitrate, frameRate); |
+ } |
+ |
+ void WaitForMax() { Wait(); } |
minyue-webrtc
2016/11/24 15:45:46
do we need this function
michaelt
2016/11/24 16:29:21
Removed the function.
I just use Wait() in Perform
|
+ |
+ void OnCallsCreated(Call* sender_call, Call* receiver_call) override { |
+ call_ = sender_call; |
+ } |
+ |
+ void ModifyVideoConfigs( |
+ VideoSendStream::Config* send_config, |
+ std::vector<VideoReceiveStream::Config>* receive_configs, |
+ VideoEncoderConfig* encoder_config) override { |
+ send_config->rtp.max_packet_size = 1200; |
+ send_config->encoder_settings.encoder = this; |
+ EXPECT_FALSE(send_config->rtp.extensions.empty()); |
+ } |
+ |
+ void PerformTest() override { |
+ call_->OnTransportOverheadChanged(webrtc::MediaType::VIDEO, 20); |
+ Call::Config::BitrateConfig bitrate_config; |
+ constexpr int kStartBitrateBps = 50000; |
+ constexpr int kMaxBitrateBps = 60000; |
+ bitrate_config.start_bitrate_bps = kStartBitrateBps; |
+ bitrate_config.max_bitrate_bps = kMaxBitrateBps; |
+ |
+ test::ScopedFieldTrials override_field_trials_( |
+ "WebRTC-SendSideBwe-WithOverhead/Enabled/"); |
+ call_->SetBitrateConfig(bitrate_config); |
+ |
+ // At a bitrate of 60kbps with a packet size of 1200B video and an |
+ // overhead |
minyue-webrtc
2016/11/24 15:45:46
merge this line with below
michaelt
2016/11/24 16:29:21
Done.
|
+ // of 40B per packet video produces 2kbps overhead. |
+ // So with a BWE should reach 58kbps but not 60kbps. |
+ WaitForMax(); |
+ EXPECT_EQ(58u, max_bitrate_kbps_); |
+ } |
+ |
+ private: |
+ Call* call_; |
+ uint32_t max_bitrate_kbps_; |
+ } test; |
+ |
+ RunBaseTest(&test); |
+} |
+ |
} // namespace webrtc |