Adds integration of the FrameEncryptor/FrameDecryptor into the MediaChannel.

This change passes a pointer (non-owning) down to the MediaChannel when set
in the RtpSender / RtpReceiver. This currently is not used to encrypt frames.

Bug: webrtc:9681
Change-Id: I385fa8b948427803cd3f9cef918c31d7754d1b4f
Reviewed-on: https://webrtc-review.googlesource.com/97000
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Emad Omara <emadomara@webrtc.org>
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24694}
diff --git a/media/base/mediachannel.h b/media/base/mediachannel.h
index a4a75ed..c1cc156 100644
--- a/media/base/mediachannel.h
+++ b/media/base/mediachannel.h
@@ -20,6 +20,8 @@
 #include "absl/types/optional.h"
 #include "api/audio_codecs/audio_encoder.h"
 #include "api/audio_options.h"
+#include "api/crypto/framedecryptorinterface.h"
+#include "api/crypto/frameencryptorinterface.h"
 #include "api/rtcerror.h"
 #include "api/rtpparameters.h"
 #include "api/rtpreceiverinterface.h"
@@ -213,9 +215,18 @@
   // ssrc must be the first SSRC of the media stream if the stream uses
   // multiple SSRCs.
   virtual bool RemoveRecvStream(uint32_t ssrc) = 0;
-
   // Returns the absoulte sendtime extension id value from media channel.
   virtual int GetRtpSendTimeExtnId() const;
+  // 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.
+  virtual void SetFrameEncryptor(
+      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.
+  virtual void SetFrameDecryptor(
+      webrtc::FrameDecryptorInterface* frame_decryptor);
 
   // Base method to send packet using NetworkInterface.
   bool SendPacket(rtc::CopyOnWriteBuffer* packet,
@@ -266,6 +277,10 @@
   // 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: