| Index: webrtc/audio/test/low_bandwidth_audio_test.cc
|
| diff --git a/webrtc/audio/test/low_bandwidth_audio_test.cc b/webrtc/audio/test/low_bandwidth_audio_test.cc
|
| index 070253e0a171b389663872f69ee6a5bdbfc18ac9..fbee83966e8770c83e9ab26b2d380d4e78f6c29b 100644
|
| --- a/webrtc/audio/test/low_bandwidth_audio_test.cc
|
| +++ b/webrtc/audio/test/low_bandwidth_audio_test.cc
|
| @@ -11,12 +11,20 @@
|
| #include <algorithm>
|
|
|
| #include "gflags/gflags.h"
|
| +
|
| #include "webrtc/audio/test/low_bandwidth_audio_test.h"
|
| +#include "webrtc/base/ptr_util.h"
|
| #include "webrtc/common_audio/wav_file.h"
|
| -#include "webrtc/test/gtest.h"
|
| +#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
|
| #include "webrtc/system_wrappers/include/sleep.h"
|
| +#include "webrtc/test/field_trial.h"
|
| +#include "webrtc/test/gmock.h"
|
| +#include "webrtc/test/gtest.h"
|
| #include "webrtc/test/testsupport/fileutils.h"
|
|
|
| +using ::testing::NiceMock;
|
| +using ::testing::Invoke;
|
| +using ::testing::_;
|
|
|
| DEFINE_int32(sample_rate_hz, 16000,
|
| "Sample rate (Hz) of the produced audio files.");
|
| @@ -26,7 +34,6 @@ DEFINE_bool(quick, false,
|
| "Used to quickly check that the test runs without crashing.");
|
|
|
| namespace {
|
| -
|
| // Wait half a second between stopping sending and stopping receiving audio.
|
| constexpr int kExtraRecordTimeMs = 500;
|
|
|
| @@ -87,6 +94,7 @@ FakeNetworkPipe::Config AudioQualityTest::GetNetworkPipeConfig() {
|
|
|
| test::PacketTransport* AudioQualityTest::CreateSendTransport(
|
| Call* sender_call) {
|
| + sender_call_ = sender_call;
|
| return new test::PacketTransport(
|
| sender_call, this, test::PacketTransport::kSender,
|
| test::CallTest::payload_type_map_, GetNetworkPipeConfig());
|
| @@ -110,6 +118,8 @@ void AudioQualityTest::ModifyAudioConfigs(
|
| }
|
|
|
| void AudioQualityTest::PerformTest() {
|
| + sender_call_->OnTransportOverheadChanged(webrtc::MediaType::AUDIO, 0);
|
| +
|
| if (FLAGS_quick) {
|
| // Let the recording run for a small amount of time to check if it works.
|
| SleepMs(1000);
|
| @@ -168,5 +178,78 @@ TEST_F(LowBandwidthAudioTest, Mobile2GNetwork) {
|
| RunBaseTest(&test);
|
| }
|
|
|
| +class StatsPollTask : public rtc::QueuedTask {
|
| + public:
|
| + explicit StatsPollTask(Call* sender_call) : sender_call_(sender_call) {}
|
| +
|
| + private:
|
| + bool Run() override {
|
| + RTC_CHECK(sender_call_);
|
| + Call::Stats call_stats = sender_call_->GetStats();
|
| + EXPECT_GT(call_stats.send_bandwidth_bps, 30000);
|
| + rtc::TaskQueue::Current()->PostDelayedTask(
|
| + std::unique_ptr<QueuedTask>(this), 100);
|
| + return false;
|
| + }
|
| + Call* sender_call_;
|
| +};
|
| +
|
| +class NoBandwidthDropAfterDtx : public AudioQualityTest {
|
| + public:
|
| + NoBandwidthDropAfterDtx() : stats_poller_("stats poller task queue") {}
|
| +
|
| + void ModifyAudioConfigs(
|
| + AudioSendStream::Config* send_config,
|
| + std::vector<AudioReceiveStream::Config>* receive_configs) override {
|
| + send_config->send_codec_spec =
|
| + rtc::Optional<AudioSendStream::Config::SendCodecSpec>(
|
| + {test::CallTest::kAudioSendPayloadType,
|
| + {"OPUS",
|
| + 48000,
|
| + 2,
|
| + {{"ptime", "60"}, {"usedtx", "1"}, {"stereo", "1"}}}});
|
| +
|
| + send_config->min_bitrate_bps = 6000;
|
| + send_config->max_bitrate_bps = 100000;
|
| + send_config->rtp.extensions.push_back(
|
| + RtpExtension(RtpExtension::kTransportSequenceNumberUri,
|
| + kTransportSequenceNumberExtensionId));
|
| + for (AudioReceiveStream::Config& recv_config : *receive_configs) {
|
| + recv_config.rtp.transport_cc = true;
|
| + recv_config.rtp.extensions = send_config->rtp.extensions;
|
| + recv_config.rtp.remote_ssrc = send_config->rtp.ssrc;
|
| + }
|
| + }
|
| +
|
| + std::string AudioInputFile() override {
|
| + return test::ResourcePath("voice_engine/audio_dtx16", "wav");
|
| + }
|
| +
|
| + FakeNetworkPipe::Config GetNetworkPipeConfig() override {
|
| + FakeNetworkPipe::Config pipe_config;
|
| + pipe_config.link_capacity_kbps = 50;
|
| + pipe_config.queue_length_packets = 1500;
|
| + pipe_config.queue_delay_ms = 300;
|
| + return pipe_config;
|
| + }
|
| +
|
| + void PerformTest() override {
|
| + stats_poller_.PostDelayedTask(
|
| + std::unique_ptr<rtc::QueuedTask>(new StatsPollTask(sender_call_)), 100);
|
| + AudioQualityTest::PerformTest();
|
| + }
|
| +
|
| + private:
|
| + rtc::TaskQueue stats_poller_;
|
| +};
|
| +
|
| +TEST_F(LowBandwidthAudioTest, NoBandwidthDropAfterDtx) {
|
| + webrtc::test::ScopedFieldTrials override_field_trials(
|
| + "WebRTC-Audio-SendSideBwe/Enabled/"
|
| + "WebRTC-SendSideBwe-WithOverhead/Enabled/");
|
| + NoBandwidthDropAfterDtx test;
|
| + RunBaseTest(&test);
|
| +}
|
| +
|
| } // namespace test
|
| } // namespace webrtc
|
|
|