Enable End-to-End Encrypted Audio Payloads.

This change integrates the FrameDecryptorInterface and the FrameEncryptorInterface into
the audio media path. If a FrameEncryptorInterface is set on an outgoing audio RTPSender
then each outgoing audio payload will first pass through the provided FrameEncryptor which
will have a chance to modify the payload contents for the purposes of encryption.

If a FrameDecryptorInterface is set on an incoming audio RtpReceiver then each incoming
audio payload will first pass through the provided FrameDecryptor which have a chance to
modify the payload contents for the purpose of decryption.

While AEAD is supported by the FrameDecryptor/FrameEncryptor interfaces this CL does not
use it and so it is left as null.

Bug: webrtc:9681
Change-Id: Ic383a9dce280528739f9d271357c2220e0a0dccf
Reviewed-on: https://webrtc-review.googlesource.com/c/101702
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Emad Omara <emadomara@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25001}
diff --git a/media/base/mediachannel.h b/media/base/mediachannel.h
index 98b36ac..ff3368c 100644
--- a/media/base/mediachannel.h
+++ b/media/base/mediachannel.h
@@ -179,10 +179,9 @@
     virtual ~NetworkInterface() {}
   };
 
-  explicit MediaChannel(const MediaConfig& config)
-      : enable_dscp_(config.enable_dscp), network_interface_(NULL) {}
-  MediaChannel() : enable_dscp_(false), network_interface_(NULL) {}
-  ~MediaChannel() override {}
+  explicit MediaChannel(const MediaConfig& config);
+  MediaChannel();
+  ~MediaChannel() override;
 
   // Sets the abstract interface class for sending RTP/RTCP data.
   virtual void SetInterface(NetworkInterface* iface);
@@ -219,13 +218,17 @@
   // Set the frame encryptor to use on all outgoing frames. This is optional.
   // This pointers lifetime is managed by the set of RtpSender it is attached
   // to.
+  // TODO(benwright) make pure virtual once internal supports it.
   virtual void SetFrameEncryptor(
-      webrtc::FrameEncryptorInterface* frame_encryptor);
+      uint32_t ssrc,
+      rtc::scoped_refptr<webrtc::FrameEncryptorInterface> frame_encryptor);
   // Set the frame decryptor to use on all incoming frames. This is optional.
   // This pointers lifetimes is managed by the set of RtpReceivers it is
   // attached to.
+  // TODO(benwright) make pure virtual once internal supports it.
   virtual void SetFrameDecryptor(
-      webrtc::FrameDecryptorInterface* frame_decryptor);
+      uint32_t ssrc,
+      rtc::scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor);
 
   // Base method to send packet using NetworkInterface.
   bool SendPacket(rtc::CopyOnWriteBuffer* packet,
@@ -281,10 +284,6 @@
   // of network_interface_ object.
   rtc::CriticalSection network_interface_crit_;
   NetworkInterface* network_interface_;
-
- protected:
-  webrtc::FrameEncryptorInterface* frame_encryptor_ = nullptr;
-  webrtc::FrameDecryptorInterface* frame_decryptor_ = nullptr;
 };
 
 // The stats information is structured as follows: