Remove obsolete ReconfigureForTesting from AudioReceiveStreamImpl

- Remove the call from ReconfigureWithUpdatedConfig - it was a no-op.
- Rename the ReconfigureWithFrameDecryptor test to SetFrameDecryptor and
  update it to test the public SetFrameDecryptor API directly.

Bug: none
Change-Id: I5697306ad317e0aef42213f828f4595e6b567d85
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/474401
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47759}
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index 72c4ab9..26a5647 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -161,30 +161,7 @@
   rtp_stream_receiver_.reset();
 }
 
-void AudioReceiveStreamImpl::ReconfigureForTesting(
-    const AudioReceiveStreamInterface::Config& config) {
-  RTC_DCHECK_RUN_ON(&worker_thread_checker_);
 
-  // SSRC can't be changed mid-stream.
-  RTC_DCHECK_EQ(remote_ssrc(), config.rtp.remote_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.
-  RTC_DCHECK_EQ(config_.rtp.nack.rtp_history_ms, config.rtp.nack.rtp_history_ms)
-      << "Use SetUseTransportCcAndNackHistory";
-
-  RTC_DCHECK(config_.decoder_map == config.decoder_map) << "Use SetDecoderMap";
-  RTC_DCHECK_EQ(config_.frame_transformer, config.frame_transformer)
-      << "Use SetDepacketizerToDecoderFrameTransformer";
-
-  config_ = config;
-}
 
 void AudioReceiveStreamImpl::Start() {
   RTC_DCHECK_RUN_ON(&worker_thread_checker_);
diff --git a/audio/audio_receive_stream.h b/audio/audio_receive_stream.h
index 36aeaaa..e1e508d 100644
--- a/audio/audio_receive_stream.h
+++ b/audio/audio_receive_stream.h
@@ -140,10 +140,6 @@
   // Must be called on the packet delivery thread.
   const std::string& sync_group() const;
 
-  // TODO(tommi): Remove this method.
-  void ReconfigureForTesting(
-      const webrtc::AudioReceiveStreamInterface::Config& config);
-
  private:
   internal::AudioState* audio_state() const;
 
diff --git a/audio/audio_receive_stream_unittest.cc b/audio/audio_receive_stream_unittest.cc
index d916fba..285a1d7 100644
--- a/audio/audio_receive_stream_unittest.cc
+++ b/audio/audio_receive_stream_unittest.cc
@@ -421,13 +421,6 @@
 
     MockChannelReceive& channel_receive = *helper.channel_receive();
 
-    // TODO(tommi, nisse): This applies new extensions to the internal config,
-    // but there's nothing that actually verifies that the changes take effect.
-    // In fact Call manages the extensions separately in Call::ReceiveRtpConfig
-    // and changing this config value (there seem to be a few copies), doesn't
-    // affect that logic.
-    recv_stream->ReconfigureForTesting(new_config);
-
     new_config.decoder_map.emplace(1, SdpAudioFormat("foo", 8000, 1));
     EXPECT_CALL(channel_receive, SetReceiveCodecs(new_config.decoder_map));
     recv_stream->SetDecoderMap(new_config.decoder_map);
@@ -439,31 +432,19 @@
   }
 }
 
-TEST(AudioReceiveStreamTest, ReconfigureWithFrameDecryptor) {
+TEST(AudioReceiveStreamTest, SetFrameDecryptorForwardsToChannelReceive) {
   test::RunLoop loop;
   for (bool use_null_audio_processing : {false, true}) {
     ConfigHelper helper(loop.task_queue(), loop.task_queue(),
                         use_null_audio_processing);
     auto recv_stream = helper.CreateAudioReceiveStream();
 
-    auto new_config_0 = helper.config();
-    scoped_refptr<FrameDecryptorInterface> mock_frame_decryptor_0(
-        make_ref_counted<MockFrameDecryptor>());
-    new_config_0.frame_decryptor = mock_frame_decryptor_0;
+    scoped_refptr<FrameDecryptorInterface> mock_frame_decryptor =
+        make_ref_counted<MockFrameDecryptor>();
+    EXPECT_CALL(*helper.channel_receive(),
+                SetFrameDecryptor(mock_frame_decryptor));
 
-    // TODO(tommi): While this changes the internal config value, it doesn't
-    // actually change what frame_decryptor is used. WebRtcAudioReceiveStream
-    // recreates the whole instance in order to change this value.
-    // So, it's not clear if changing this post initialization needs to be
-    // supported.
-    recv_stream->ReconfigureForTesting(new_config_0);
-
-    auto new_config_1 = helper.config();
-    scoped_refptr<FrameDecryptorInterface> mock_frame_decryptor_1(
-        make_ref_counted<MockFrameDecryptor>());
-    new_config_1.frame_decryptor = mock_frame_decryptor_1;
-    new_config_1.crypto_options.sframe.require_frame_encryption = true;
-    recv_stream->ReconfigureForTesting(new_config_1);
+    recv_stream->SetFrameDecryptor(mock_frame_decryptor);
     recv_stream->UnregisterFromTransport();
   }
 }