From ad8719442b269dae3a4f95c274eb46f1e718e504 Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Wed, 16 Jan 2019 17:21:28 +0100 Subject: [PATCH] Adds audio DTX and mute support to scenario tests. Bug: webrtc:9510 Change-Id: I50a12c319141dd505309830afdc169c6811c5eca Reviewed-on: https://webrtc-review.googlesource.com/c/117920 Reviewed-by: Christoffer Rodbro Commit-Queue: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#26288} --- test/scenario/audio_stream.cc | 6 ++++++ test/scenario/audio_stream.h | 1 + test/scenario/scenario_config.h | 1 + 3 files changed, 8 insertions(+) diff --git a/test/scenario/audio_stream.cc b/test/scenario/audio_stream.cc index d924275803..2cbd37d723 100644 --- a/test/scenario/audio_stream.cc +++ b/test/scenario/audio_stream.cc @@ -79,6 +79,8 @@ SendAudioStream::SendAudioStream( if (config.encoder.initial_frame_length != TimeDelta::ms(20)) sdp_params["ptime"] = std::to_string(config.encoder.initial_frame_length.ms()); + if (config.encoder.enable_dtx) + sdp_params["usedtx"] = "1"; // SdpAudioFormat::num_channels indicates that the encoder is capable of // stereo, but the actual channel count used is based on the "stereo" @@ -156,6 +158,10 @@ void SendAudioStream::Start() { sender_->call_->SignalChannelNetworkState(MediaType::AUDIO, kNetworkUp); } +void SendAudioStream::SetMuted(bool mute) { + send_stream_->SetMuted(mute); +} + ColumnPrinter SendAudioStream::StatsPrinter() { return ColumnPrinter::Lambda( "audio_target_rate", diff --git a/test/scenario/audio_stream.h b/test/scenario/audio_stream.h index 430e333470..2fc1fb7a34 100644 --- a/test/scenario/audio_stream.h +++ b/test/scenario/audio_stream.h @@ -29,6 +29,7 @@ class SendAudioStream { RTC_DISALLOW_COPY_AND_ASSIGN(SendAudioStream); ~SendAudioStream(); void Start(); + void SetMuted(bool mute); ColumnPrinter StatsPrinter(); private: diff --git a/test/scenario/scenario_config.h b/test/scenario/scenario_config.h index fc0da056fb..fb6e40e330 100644 --- a/test/scenario/scenario_config.h +++ b/test/scenario/scenario_config.h @@ -169,6 +169,7 @@ struct AudioStreamConfig { Encoder(const Encoder&); ~Encoder(); bool allocate_bitrate = false; + bool enable_dtx = false; absl::optional fixed_rate; absl::optional min_rate; absl::optional max_rate;