Reland "Remove AudioReceiveStream::Reconfigure() method."

This reverts commit 8a18e5b3c954a3f9cc006c90356a3d850bcc352f.

Reason for revert: Removing the problematic DCHECK.

Original change's description:
> Revert "Remove AudioReceiveStream::Reconfigure() method."
>
> This reverts commit e2561e17e29e62c02731f1d214d7ee5ffdaeb941.
>
> Reason for revert: Speculative revert: breaks an downstream project
>
> Original change's description:
> > Remove AudioReceiveStream::Reconfigure() method.
> >
> > Instead, adding specific setters that are needed at runtime:
> > * SetDepacketizerToDecoderFrameTransformer
> > * SetDecoderMap
> > * SetUseTransportCcAndNackHistory
> >
> > The whole config struct is big and much of the state it holds, needs to
> > be considered const. For that reason the Reconfigure() method is too
> > broad of an interface since it overwrites the whole config struct
> > and doesn't actually handle all the potential config changes that might
> > occur when the config changes.
> >
> > Bug: webrtc:11993
> > Change-Id: Ia5311978f56b2e136781467e44f0d18039f0bb2d
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221363
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Commit-Queue: Tommi <tommi@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#34252}
>
> TBR=saza@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com
>
> Change-Id: I15ca2d8ee5fd612e13dc1f4b3bfb9c885c21dc66
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:11993
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221746
> Commit-Queue: Artem Titov <titovartem@webrtc.org>
> Reviewed-by: Andrey Logvin <landrey@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#34253}

# Not skipping CQ checks because this is a reland.

Bug: webrtc:11993
Change-Id: I0d3bf9abdcdc8d3f9259d014e6074a5e6b6cc73c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221747
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34255}
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index aecc246..cc53a74 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -84,8 +84,8 @@
       config.jitter_buffer_max_packets, config.jitter_buffer_fast_accelerate,
       config.jitter_buffer_min_delay_ms,
       config.jitter_buffer_enable_rtx_handling, config.decoder_factory,
-      config.codec_pair_id, config.frame_decryptor, config.crypto_options,
-      std::move(config.frame_transformer));
+      config.codec_pair_id, std::move(config.frame_decryptor),
+      config.crypto_options, std::move(config.frame_transformer));
 }
 }  // namespace
 
@@ -143,8 +143,8 @@
   channel_receive_->SetNACKStatus(config.rtp.nack.rtp_history_ms != 0,
                                   config.rtp.nack.rtp_history_ms / 20);
   channel_receive_->SetReceiveCodecs(config.decoder_map);
-  channel_receive_->SetDepacketizerToDecoderFrameTransformer(
-      config.frame_transformer);
+  // `frame_transformer` and `frame_decryptor` have been given to
+  // `channel_receive_` already.
 }
 
 AudioReceiveStream::~AudioReceiveStream() {
@@ -168,35 +168,28 @@
   rtp_stream_receiver_.reset();
 }
 
-void AudioReceiveStream::Reconfigure(
+void AudioReceiveStream::ReconfigureForTesting(
     const webrtc::AudioReceiveStream::Config& config) {
-  RTC_DCHECK(worker_thread_checker_.IsCurrent());
-
-  // Configuration parameters which cannot be changed.
-  RTC_DCHECK(config_.rtp.remote_ssrc == config.rtp.remote_ssrc);
-  RTC_DCHECK(config_.rtcp_send_transport == config.rtcp_send_transport);
-  // Decoder factory cannot be changed because it is configured at
-  // voe::Channel construction time.
-  RTC_DCHECK(config_.decoder_factory == config.decoder_factory);
+  RTC_DCHECK_RUN_ON(&worker_thread_checker_);
 
   // SSRC can't be changed mid-stream.
-  RTC_DCHECK_EQ(config_.rtp.local_ssrc, config.rtp.local_ssrc);
   RTC_DCHECK_EQ(config_.rtp.remote_ssrc, config.rtp.remote_ssrc);
+  RTC_DCHECK_EQ(config_.rtp.local_ssrc, config.rtp.local_ssrc);
+
+  // Configuration parameters which cannot be changed.
+  RTC_DCHECK_EQ(config_.rtcp_send_transport, config.rtcp_send_transport);
+  // Decoder factory cannot be changed because it is configured at
+  // voe::Channel construction time.
+  RTC_DCHECK_EQ(config_.decoder_factory, config.decoder_factory);
 
   // TODO(solenberg): Config NACK history window (which is a packet count),
   // using the actual packet size for the configured codec.
-  if (config_.rtp.nack.rtp_history_ms != config.rtp.nack.rtp_history_ms) {
-    channel_receive_->SetNACKStatus(config.rtp.nack.rtp_history_ms != 0,
-                                    config.rtp.nack.rtp_history_ms / 20);
-  }
-  if (config_.decoder_map != config.decoder_map) {
-    channel_receive_->SetReceiveCodecs(config.decoder_map);
-  }
+  RTC_DCHECK_EQ(config_.rtp.nack.rtp_history_ms, config.rtp.nack.rtp_history_ms)
+      << "Use SetUseTransportCcAndNackHistory";
 
-  if (config_.frame_transformer != config.frame_transformer) {
-    channel_receive_->SetDepacketizerToDecoderFrameTransformer(
-        config.frame_transformer);
-  }
+  RTC_DCHECK(config_.decoder_map == config.decoder_map) << "Use SetDecoderMap";
+  RTC_DCHECK_EQ(config_.frame_transformer, config.frame_transformer)
+      << "Use SetDepacketizerToDecoderFrameTransformer";
 
   config_ = config;
 }
@@ -226,6 +219,33 @@
   return playing_;
 }
 
+void AudioReceiveStream::SetDepacketizerToDecoderFrameTransformer(
+    rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer) {
+  RTC_DCHECK_RUN_ON(&worker_thread_checker_);
+  channel_receive_->SetDepacketizerToDecoderFrameTransformer(
+      std::move(frame_transformer));
+}
+
+void AudioReceiveStream::SetDecoderMap(
+    std::map<int, SdpAudioFormat> decoder_map) {
+  RTC_DCHECK_RUN_ON(&worker_thread_checker_);
+  config_.decoder_map = std::move(decoder_map);
+  channel_receive_->SetReceiveCodecs(config_.decoder_map);
+}
+
+void AudioReceiveStream::SetUseTransportCcAndNackHistory(bool use_transport_cc,
+                                                         int history_ms) {
+  RTC_DCHECK_RUN_ON(&worker_thread_checker_);
+  RTC_DCHECK_GE(history_ms, 0);
+  config_.rtp.transport_cc = use_transport_cc;
+  if (config_.rtp.nack.rtp_history_ms != history_ms) {
+    config_.rtp.nack.rtp_history_ms = history_ms;
+    // TODO(solenberg): Config NACK history window (which is a packet count),
+    // using the actual packet size for the configured codec.
+    channel_receive_->SetNACKStatus(history_ms != 0, history_ms / 20);
+  }
+}
+
 webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats(
     bool get_and_clear_legacy_stats) const {
   RTC_DCHECK_RUN_ON(&worker_thread_checker_);