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 <crodbro@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26288}
diff --git a/test/scenario/audio_stream.cc b/test/scenario/audio_stream.cc
index d924275..2cbd37d 100644
--- a/test/scenario/audio_stream.cc
+++ b/test/scenario/audio_stream.cc
@@ -79,6 +79,8 @@
   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 @@
   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 430e333..2fc1fb7 100644
--- a/test/scenario/audio_stream.h
+++ b/test/scenario/audio_stream.h
@@ -29,6 +29,7 @@
   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 fc0da05..fb6e40e 100644
--- a/test/scenario/scenario_config.h
+++ b/test/scenario/scenario_config.h
@@ -169,6 +169,7 @@
     Encoder(const Encoder&);
     ~Encoder();
     bool allocate_bitrate = false;
+    bool enable_dtx = false;
     absl::optional<DataRate> fixed_rate;
     absl::optional<DataRate> min_rate;
     absl::optional<DataRate> max_rate;