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

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
« no previous file with comments | « webrtc/video/video_send_stream.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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."
minyue-webrtc 2016/11/24 15:45:46 remove "
michaelt 2016/11/24 16:29:21 Done.
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 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
3199
3200 void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
3201 call_ = sender_call;
3202 }
3203
3204 void ModifyVideoConfigs(
3205 VideoSendStream::Config* send_config,
3206 std::vector<VideoReceiveStream::Config>* receive_configs,
3207 VideoEncoderConfig* encoder_config) override {
3208 send_config->rtp.max_packet_size = 1200;
3209 send_config->encoder_settings.encoder = this;
3210 EXPECT_FALSE(send_config->rtp.extensions.empty());
3211 }
3212
3213 void PerformTest() override {
3214 call_->OnTransportOverheadChanged(webrtc::MediaType::VIDEO, 20);
3215 Call::Config::BitrateConfig bitrate_config;
3216 constexpr int kStartBitrateBps = 50000;
3217 constexpr int kMaxBitrateBps = 60000;
3218 bitrate_config.start_bitrate_bps = kStartBitrateBps;
3219 bitrate_config.max_bitrate_bps = kMaxBitrateBps;
3220
3221 test::ScopedFieldTrials override_field_trials_(
3222 "WebRTC-SendSideBwe-WithOverhead/Enabled/");
3223 call_->SetBitrateConfig(bitrate_config);
3224
3225 // At a bitrate of 60kbps with a packet size of 1200B video and an
3226 // overhead
minyue-webrtc 2016/11/24 15:45:46 merge this line with below
michaelt 2016/11/24 16:29:21 Done.
3227 // of 40B per packet video produces 2kbps overhead.
3228 // So with a BWE should reach 58kbps but not 60kbps.
3229 WaitForMax();
3230 EXPECT_EQ(58u, max_bitrate_kbps_);
3231 }
3232
3233 private:
3234 Call* call_;
3235 uint32_t max_bitrate_kbps_;
3236 } test;
3237
3238 RunBaseTest(&test);
3239 }
3240
3177 } // namespace webrtc 3241 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_send_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698