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

Unified Diff: webrtc/audio/test/low_bandwidth_audio_test.cc

Issue 2931873002: Test and fix for huge bwe drop after alr state. (Closed)
Patch Set: Response to comments. 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 side-by-side diff with in-line comments
Download patch
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..4958cf4b153edf0fcf5f21e942c7ff45f7465652 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,72 @@ TEST_F(LowBandwidthAudioTest, Mobile2GNetwork) {
RunBaseTest(&test);
}
+class NoBandwidthDropAfterDTX : public AudioQualityTest {
+ 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");
+ }
+
+ void LogDelayBasedBweUpdate(int32_t bitrate_bps,
philipel 2017/06/14 09:34:05 Remove if not used.
tschumi 2017/06/14 10:57:46 Oops, this should not be like that.
+ BandwidthUsage detector_state) {
+ EXPECT_GE(bitrate_bps, 30000);
+ }
+
+ Call::Config GetSenderCallConfig() override {
+ event_log_ = std::unique_ptr<RtcEventLog>(RtcEventLog::Create());
+ event_log_->StartLogging("dtx_test_event_log.dat");
+
+ // EXPECT_CALL(mock_event_log_, LogDelayBasedBweUpdate(_, _))
philipel 2017/06/14 09:34:05 Remove commented code.
tschumi 2017/06/14 10:57:46 Oops, this should not be like that.
+ // .WillRepeatedly(Invoke(this, &DTXTest::LogDelayBasedBweUpdate));
+
+ // Call::Config call_config(&mock_event_log_);
+ Call::Config call_config(event_log_.get());
+
+ return call_config;
+ }
+
+ 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;
+ }
+
+ private:
+ NiceMock<MockRtcEventLog> mock_event_log_;
+ std::unique_ptr<RtcEventLog> event_log_;
+};
+
+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

Powered by Google App Engine
This is Rietveld 408576698