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

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 2517243005: Remove overhead from video bitrate. (Closed)
Patch Set: Respond to comments. Created 4 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include <algorithm> // max 10 #include <algorithm> // max
(...skipping 18 matching lines...) Expand all
29 #include "webrtc/system_wrappers/include/sleep.h" 29 #include "webrtc/system_wrappers/include/sleep.h"
30 #include "webrtc/test/call_test.h" 30 #include "webrtc/test/call_test.h"
31 #include "webrtc/test/configurable_frame_size_encoder.h" 31 #include "webrtc/test/configurable_frame_size_encoder.h"
32 #include "webrtc/test/fake_texture_frame.h" 32 #include "webrtc/test/fake_texture_frame.h"
33 #include "webrtc/test/frame_generator.h" 33 #include "webrtc/test/frame_generator.h"
34 #include "webrtc/test/frame_utils.h" 34 #include "webrtc/test/frame_utils.h"
35 #include "webrtc/test/gtest.h" 35 #include "webrtc/test/gtest.h"
36 #include "webrtc/test/null_transport.h" 36 #include "webrtc/test/null_transport.h"
37 #include "webrtc/test/rtcp_packet_parser.h" 37 #include "webrtc/test/rtcp_packet_parser.h"
38 #include "webrtc/test/testsupport/perf_test.h" 38 #include "webrtc/test/testsupport/perf_test.h"
39 #include "webrtc/test/field_trial.h"
39 40
40 #include "webrtc/video/send_statistics_proxy.h" 41 #include "webrtc/video/send_statistics_proxy.h"
41 #include "webrtc/video/transport_adapter.h" 42 #include "webrtc/video/transport_adapter.h"
42 #include "webrtc/video_frame.h" 43 #include "webrtc/video_frame.h"
43 #include "webrtc/video_send_stream.h" 44 #include "webrtc/video_send_stream.h"
44 45
45 namespace webrtc { 46 namespace webrtc {
46 47
47 enum VideoFormat { kGeneric, kVP8, }; 48 enum VideoFormat { kGeneric, kVP8, };
48 49
(...skipping 3118 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 TEST_F(VideoSendStreamTest, 3168 TEST_F(VideoSendStreamTest,
3168 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { 3169 RequestSourceRotateIfVideoOrientationExtensionNotSupported) {
3169 TestRequestSourceRotateVideo(false); 3170 TestRequestSourceRotateVideo(false);
3170 } 3171 }
3171 3172
3172 TEST_F(VideoSendStreamTest, 3173 TEST_F(VideoSendStreamTest,
3173 DoNotRequestsRotationIfVideoOrientationExtensionSupported) { 3174 DoNotRequestsRotationIfVideoOrientationExtensionSupported) {
3174 TestRequestSourceRotateVideo(true); 3175 TestRequestSourceRotateVideo(true);
3175 } 3176 }
3176 3177
3178 // This test verifies that overhead is removed from the bandwidth estimate by
3179 // testing that the maximum possible target payload rate is smaller than the
3180 // maximum bandwidth estimate by the overhead rate.
3181 TEST_F(VideoSendStreamTest, RemoveOverheadFromBandwidth) {
3182 class RemoveOverheadFromBandwidthTest : public test::EndToEndTest,
3183 public test::FakeEncoder {
3184 public:
3185 RemoveOverheadFromBandwidthTest()
3186 : EndToEndTest(test::CallTest::kDefaultTimeoutMs),
3187 FakeEncoder(Clock::GetRealTimeClock()),
3188 call_(nullptr),
3189 max_bitrate_kbps_(0) {}
3190
3191 int32_t SetRateAllocation(const BitrateAllocation& bitrate,
3192 uint32_t frameRate) override {
3193 if (max_bitrate_kbps_ < bitrate.get_sum_kbps())
3194 max_bitrate_kbps_ = bitrate.get_sum_kbps();
3195 return FakeEncoder::SetRateAllocation(bitrate, frameRate);
3196 }
3197
3198 void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
3199 call_ = sender_call;
3200 }
3201
3202 void ModifyVideoConfigs(
3203 VideoSendStream::Config* send_config,
3204 std::vector<VideoReceiveStream::Config>* receive_configs,
3205 VideoEncoderConfig* encoder_config) override {
3206 send_config->rtp.max_packet_size = 1200;
3207 send_config->encoder_settings.encoder = this;
3208 EXPECT_FALSE(send_config->rtp.extensions.empty());
3209 }
3210
3211 void PerformTest() override {
3212 call_->OnTransportOverheadChanged(webrtc::MediaType::VIDEO, 20);
3213 Call::Config::BitrateConfig bitrate_config;
3214 constexpr int kStartBitrateBps = 50000;
3215 constexpr int kMaxBitrateBps = 60000;
3216 bitrate_config.start_bitrate_bps = kStartBitrateBps;
3217 bitrate_config.max_bitrate_bps = kMaxBitrateBps;
3218
3219 test::ScopedFieldTrials override_field_trials_(
minyue-webrtc 2016/11/25 10:50:33 nit: override_field_trials
michaelt 2016/11/28 13:52:21 Done.
3220 "WebRTC-SendSideBwe-WithOverhead/Enabled/");
3221 call_->SetBitrateConfig(bitrate_config);
3222
3223 // At a bitrate of 60kbps with a packet size of 1200B video and an
3224 // overhead of 40B per packet video produces 2kbps overhead.
3225 // So with a BWE should reach 58kbps but not 60kbps.
3226 Wait();
3227 EXPECT_EQ(58u, max_bitrate_kbps_);
3228 }
3229
3230 private:
3231 Call* call_;
3232 uint32_t max_bitrate_kbps_;
3233 } test;
3234
3235 RunBaseTest(&test);
3236 }
3237
3177 } // namespace webrtc 3238 } // namespace webrtc
OLDNEW
« webrtc/video/video_send_stream.cc ('K') | « webrtc/video/video_send_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698