Remove unused/unnecessary things from ChannelSend.

Bug: none
Change-Id: I48e105d39597c3a84402599af7289f2ea9adc0c6
Reviewed-on: https://webrtc-review.googlesource.com/c/111183
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25671}
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index 00c66a2..c88a52e 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -199,7 +199,6 @@
   RTC_DCHECK(rtp_transport || config.media_transport);
   RTC_DCHECK(overall_call_lifetime_);
 
-  channel_proxy_->SetRTCPStatus(true);
   rtp_rtcp_module_ = channel_proxy_->GetRtpRtcp();
   RTC_DCHECK(rtp_rtcp_module_);
 
diff --git a/audio/audio_send_stream_unittest.cc b/audio/audio_send_stream_unittest.cc
index ed94283..e226221 100644
--- a/audio/audio_send_stream_unittest.cc
+++ b/audio/audio_send_stream_unittest.cc
@@ -193,7 +193,6 @@
     EXPECT_CALL(*channel_proxy_, GetRtpRtcp()).WillRepeatedly(Invoke([this]() {
       return &this->rtp_rtcp_;
     }));
-    EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1);
     EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1);
     EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1);
     EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 10)).Times(1);
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 09482a4..abdb980 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -442,12 +442,6 @@
   return true;
 }
 
-int ChannelSend::PreferredSampleRate() const {
-  // Return the bigger of playout and receive frequency in the ACM.
-  return std::max(audio_coding_->ReceiveFrequency(),
-                  audio_coding_->PlayoutFrequency());
-}
-
 ChannelSend::ChannelSend(rtc::TaskQueue* encoder_queue,
                          ProcessThread* module_process_thread,
                          MediaTransportInterface* media_transport,
@@ -505,26 +499,14 @@
 
   _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration));
   _rtpRtcpModule->SetSendingMediaStatus(false);
-  Init();
-}
 
-ChannelSend::~ChannelSend() {
-  Terminate();
-  RTC_DCHECK(!channel_state_.Get().sending);
-}
-
-void ChannelSend::Init() {
   channel_state_.Reset();
 
-  // --- Add modules to process thread (for periodic schedulation)
   _moduleProcessThreadPtr->RegisterModule(_rtpRtcpModule.get(), RTC_FROM_HERE);
 
-  // --- ACM initialization
   int error = audio_coding_->InitializeReceiver();
   RTC_DCHECK_EQ(0, error);
 
-  // --- RTP/RTCP module initialization
-
   // Ensure that RTCP is enabled by default for the created channel.
   // Note that, the module will keep generating RTCP until it is explicitly
   // disabled by the user.
@@ -533,29 +515,22 @@
   // RTCP is enabled by default.
   _rtpRtcpModule->SetRTCPStatus(RtcpMode::kCompound);
 
-  // --- Register all permanent callbacks
   error = audio_coding_->RegisterTransportCallback(this);
   RTC_DCHECK_EQ(0, error);
 }
 
-void ChannelSend::Terminate() {
+ChannelSend::~ChannelSend() {
   RTC_DCHECK(construction_thread_.CalledOnValidThread());
-  // Must be called on the same thread as Init().
 
   StopSend();
 
-  // The order to safely shutdown modules in a channel is:
-  // 1. De-register callbacks in modules
-  // 2. De-register modules in process thread
-  // 3. Destroy modules
   int error = audio_coding_->RegisterTransportCallback(NULL);
   RTC_DCHECK_EQ(0, error);
 
-  // De-register modules in process thread
   if (_moduleProcessThreadPtr)
     _moduleProcessThreadPtr->DeRegisterModule(_rtpRtcpModule.get());
 
-  // End of modules shutdown
+  RTC_DCHECK(!channel_state_.Get().sending);
 }
 
 void ChannelSend::StartSend() {
@@ -853,10 +828,6 @@
   rtp_packet_sender_proxy_->SetPacketSender(nullptr);
 }
 
-void ChannelSend::SetRTCPStatus(bool enable) {
-  _rtpRtcpModule->SetRTCPStatus(enable ? RtcpMode::kCompound : RtcpMode::kOff);
-}
-
 void ChannelSend::SetRTCP_CNAME(absl::string_view c_name) {
   // Note: SetCNAME() accepts a c string of length at most 255.
   const std::string c_name_limited(c_name.substr(0, 255));
diff --git a/audio/channel_send.h b/audio/channel_send.h
index 29b472a1..6fefd28 100644
--- a/audio/channel_send.h
+++ b/audio/channel_send.h
@@ -175,7 +175,6 @@
       RtpTransportControllerSendInterface* transport,
       RtcpBandwidthObserver* bandwidth_observer);
   void ResetSenderCongestionControlObjects();
-  void SetRTCPStatus(bool enable);
   void SetRTCP_CNAME(absl::string_view c_name);
   std::vector<ReportBlock> GetRemoteRTCPReportBlocks() const;
   CallSendStatistics GetRTCPStatistics() const;
@@ -212,9 +211,6 @@
  private:
   class ProcessAndEncodeAudioTask;
 
-  void Init();
-  void Terminate();
-
   // From AudioPacketizationCallback in the ACM
   int32_t SendData(FrameType frameType,
                    uint8_t payloadType,
@@ -229,8 +225,6 @@
                const PacketOptions& packet_options) override;
   bool SendRtcp(const uint8_t* data, size_t len) override;
 
-  int PreferredSampleRate() const;
-
   bool Sending() const { return channel_state_.Get().sending; }
 
   // From OverheadObserver in the RTP/RTCP module
diff --git a/audio/channel_send_proxy.cc b/audio/channel_send_proxy.cc
index 1fe87a0..961528a 100644
--- a/audio/channel_send_proxy.cc
+++ b/audio/channel_send_proxy.cc
@@ -66,11 +66,6 @@
   channel_->ModifyEncoder(modifier);
 }
 
-void ChannelSendProxy::SetRTCPStatus(bool enable) {
-  RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
-  channel_->SetRTCPStatus(enable);
-}
-
 void ChannelSendProxy::SetMid(const std::string& mid, int extension_id) {
   RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
   channel_->SetMid(mid, extension_id);
diff --git a/audio/channel_send_proxy.h b/audio/channel_send_proxy.h
index e26ef54..a606ea1 100644
--- a/audio/channel_send_proxy.h
+++ b/audio/channel_send_proxy.h
@@ -55,7 +55,6 @@
   virtual void ModifyEncoder(
       rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier);
 
-  virtual void SetRTCPStatus(bool enable);
   virtual void SetMid(const std::string& mid, int extension_id);
   virtual void SetRTCP_CNAME(absl::string_view c_name);
   virtual void SetExtmapAllowMixed(bool extmap_allow_mixed);
diff --git a/audio/mock_voe_channel_proxy.h b/audio/mock_voe_channel_proxy.h
index 2ded3a3..84e96af 100644
--- a/audio/mock_voe_channel_proxy.h
+++ b/audio/mock_voe_channel_proxy.h
@@ -72,7 +72,6 @@
   MOCK_METHOD1(
       ModifyEncoder,
       void(rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier));
-  MOCK_METHOD1(SetRTCPStatus, void(bool enable));
   MOCK_METHOD1(SetLocalSSRC, void(uint32_t ssrc));
   MOCK_METHOD1(SetRTCP_CNAME, void(absl::string_view c_name));
   MOCK_METHOD2(SetNACKStatus, void(bool enable, int max_packets));