Move ownership of the Channel class to RTCRtpTransceiver

This makes the channel manager object into a factory, not a manager.

Bug: webrtc:13931
Change-Id: I59f7d818a739797a7c0a7a32e6583450834df122
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260467
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36718}
diff --git a/pc/channel_interface.h b/pc/channel_interface.h
index a16a9b7..a82880b 100644
--- a/pc/channel_interface.h
+++ b/pc/channel_interface.h
@@ -11,6 +11,7 @@
 #ifndef PC_CHANNEL_INTERFACE_H_
 #define PC_CHANNEL_INTERFACE_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -42,8 +43,10 @@
 // ChannelInterface contains methods common to voice and video channels.
 // As more methods are added to BaseChannel, they should be included in the
 // interface as well.
+// TODO(bugs.webrtc.org/13931): Merge this class into RtpTransceiver.
 class ChannelInterface {
  public:
+  virtual ~ChannelInterface() = default;
   virtual cricket::MediaType media_type() const = 0;
 
   virtual MediaChannel* media_channel() const = 0;
@@ -83,14 +86,11 @@
   //   * An SrtpTransport for SDES.
   //   * A DtlsSrtpTransport for DTLS-SRTP.
   virtual bool SetRtpTransport(webrtc::RtpTransportInternal* rtp_transport) = 0;
-
- protected:
-  virtual ~ChannelInterface() = default;
 };
 
 class ChannelFactoryInterface {
  public:
-  virtual VideoChannel* CreateVideoChannel(
+  virtual std::unique_ptr<VideoChannel> CreateVideoChannel(
       webrtc::Call* call,
       const MediaConfig& media_config,
       const std::string& mid,
@@ -100,7 +100,7 @@
       webrtc::VideoBitrateAllocatorFactory*
           video_bitrate_allocator_factory) = 0;
 
-  virtual VoiceChannel* CreateVoiceChannel(
+  virtual std::unique_ptr<VoiceChannel> CreateVoiceChannel(
       webrtc::Call* call,
       const MediaConfig& media_config,
       const std::string& mid,
@@ -108,8 +108,6 @@
       const webrtc::CryptoOptions& crypto_options,
       const AudioOptions& options) = 0;
 
-  virtual void DestroyChannel(ChannelInterface* channel) = 0;
-
  protected:
   virtual ~ChannelFactoryInterface() = default;
 };