Add SetKeyFrameRequestCallback to MediaTransportInterface

And implemented in LoopbackMediaTransport.

Bug: webrtc:9719
Change-Id: I68b16c2b6ed5583ffe9a5266e3d4cb1d94afbb97
Reviewed-on: https://webrtc-review.googlesource.com/c/113523
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25948}
diff --git a/api/media_transport_interface.h b/api/media_transport_interface.h
index 6b461cf..6f2ec60 100644
--- a/api/media_transport_interface.h
+++ b/api/media_transport_interface.h
@@ -239,6 +239,15 @@
   RTC_DEPRECATED virtual void OnKeyFrameRequested(uint64_t channel_id) {}
 };
 
+// Interface for video sender to be notified of received key frame request.
+class MediaTransportKeyFrameRequestCallback {
+ public:
+  virtual ~MediaTransportKeyFrameRequestCallback() = default;
+
+  // Called when a key frame request is received on the transport.
+  virtual void OnKeyFrameRequested(uint64_t channel_id) = 0;
+};
+
 // State of the media transport.  Media transport begins in the pending state.
 // It transitions to writable when it is ready to send media.  It may transition
 // back to pending if the connection is blocked.  It may transition to closed at
@@ -339,6 +348,10 @@
       uint64_t channel_id,
       const MediaTransportEncodedVideoFrame& frame) = 0;
 
+  // Used by video sender to be notified on key frame requests.
+  virtual void SetKeyFrameRequestCallback(
+      MediaTransportKeyFrameRequestCallback* callback);
+
   // Requests a keyframe for the particular channel (stream). The caller should
   // check that the keyframe is not present in a jitter buffer already (i.e.
   // don't request a keyframe if there is one that you will get from the jitter