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

Side by Side Diff: webrtc/audio/test/audio_bwe_integration_test.cc

Issue 2931873002: Test and fix for huge bwe drop after alr state. (Closed)
Patch Set: fix_for_unittest Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/audio/test/audio_bwe_integration_test.h"
12
13 #include "webrtc/base/ptr_util.h"
14 #include "webrtc/common_audio/wav_file.h"
15 #include "webrtc/system_wrappers/include/sleep.h"
16 #include "webrtc/test/field_trial.h"
17 #include "webrtc/test/gtest.h"
18 #include "webrtc/test/testsupport/fileutils.h"
19
20 namespace webrtc {
21 namespace test {
22
23 AudioBweTest::AudioBweTest() : EndToEndTest(CallTest::kDefaultTimeoutMs) {}
24
25 size_t AudioBweTest::GetNumVideoStreams() const {
26 return 0;
27 }
28 size_t AudioBweTest::GetNumAudioStreams() const {
29 return 1;
30 }
31 size_t AudioBweTest::GetNumFlexfecStreams() const {
32 return 0;
33 }
34
35 std::unique_ptr<test::FakeAudioDevice::Capturer>
36 AudioBweTest::CreateCapturer() {
37 return test::FakeAudioDevice::CreateWavFileReader(AudioInputFile());
38 }
39
40 void AudioBweTest::OnFakeAudioDevicesCreated(
41 test::FakeAudioDevice* send_audio_device,
42 test::FakeAudioDevice* recv_audio_device) {
43 send_audio_device_ = send_audio_device;
44 }
45
46 test::PacketTransport* AudioBweTest::CreateSendTransport(Call* sender_call) {
47 return new test::PacketTransport(
48 sender_call, this, test::PacketTransport::kSender,
49 test::CallTest::payload_type_map_, GetNetworkPipeConfig());
50 }
51
52 test::PacketTransport* AudioBweTest::CreateReceiveTransport() {
53 return new test::PacketTransport(
54 nullptr, this, test::PacketTransport::kReceiver,
55 test::CallTest::payload_type_map_, GetNetworkPipeConfig());
56 }
57
58 void AudioBweTest::PerformTest() {
59 send_audio_device_->WaitForRecordingEnd();
60 SleepMs(GetNetworkPipeConfig().queue_delay_ms);
61 }
62
63 class StatsPollTask : public rtc::QueuedTask {
64 public:
65 explicit StatsPollTask(Call* sender_call) : sender_call_(sender_call) {}
66
67 private:
68 bool Run() override {
69 RTC_CHECK(sender_call_);
70 Call::Stats call_stats = sender_call_->GetStats();
71 EXPECT_GT(call_stats.send_bandwidth_bps, 30000);
72 rtc::TaskQueue::Current()->PostDelayedTask(
73 std::unique_ptr<QueuedTask>(this), 100);
74 return false;
75 }
76 Call* sender_call_;
77 };
78
79 class NoBandwidthDropAfterDtx : public AudioBweTest {
80 public:
81 NoBandwidthDropAfterDtx()
82 : sender_call_(nullptr), stats_poller_("stats poller task queue") {}
83
84 void ModifyAudioConfigs(
85 AudioSendStream::Config* send_config,
86 std::vector<AudioReceiveStream::Config>* receive_configs) override {
87 send_config->send_codec_spec =
88 rtc::Optional<AudioSendStream::Config::SendCodecSpec>(
89 {test::CallTest::kAudioSendPayloadType,
90 {"OPUS",
91 48000,
92 2,
93 {{"ptime", "60"}, {"usedtx", "1"}, {"stereo", "1"}}}});
94
95 send_config->min_bitrate_bps = 6000;
96 send_config->max_bitrate_bps = 100000;
97 send_config->rtp.extensions.push_back(
98 RtpExtension(RtpExtension::kTransportSequenceNumberUri,
99 kTransportSequenceNumberExtensionId));
100 for (AudioReceiveStream::Config& recv_config : *receive_configs) {
101 recv_config.rtp.transport_cc = true;
102 recv_config.rtp.extensions = send_config->rtp.extensions;
103 recv_config.rtp.remote_ssrc = send_config->rtp.ssrc;
104 }
105 }
106
107 std::string AudioInputFile() override {
108 return test::ResourcePath("voice_engine/audio_dtx16", "wav");
109 }
110
111 FakeNetworkPipe::Config GetNetworkPipeConfig() override {
112 FakeNetworkPipe::Config pipe_config;
113 pipe_config.link_capacity_kbps = 50;
114 pipe_config.queue_length_packets = 1500;
115 pipe_config.queue_delay_ms = 300;
116 return pipe_config;
117 }
118
119 void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
120 sender_call_ = sender_call;
121 }
122
123 void PerformTest() override {
124 stats_poller_.PostDelayedTask(
125 std::unique_ptr<rtc::QueuedTask>(new StatsPollTask(sender_call_)), 100);
126 sender_call_->OnTransportOverheadChanged(webrtc::MediaType::AUDIO, 0);
127 AudioBweTest::PerformTest();
128 }
129
130 private:
131 Call* sender_call_;
132 rtc::TaskQueue stats_poller_;
133 };
134
135 using AudioBweIntegrationTest = CallTest;
136
137 TEST_F(AudioBweIntegrationTest, NoBandwidthDropAfterDtx) {
138 webrtc::test::ScopedFieldTrials override_field_trials(
139 "WebRTC-Audio-SendSideBwe/Enabled/"
140 "WebRTC-SendSideBwe-WithOverhead/Enabled/");
141 NoBandwidthDropAfterDtx test;
142 RunBaseTest(&test);
143 }
144
145 } // namespace test
146 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/test/audio_bwe_integration_test.h ('k') | webrtc/modules/congestion_controller/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698