Deprecate RtpRtcp::SetKeyFrameRequestMethod

Replaced by separate methods
SendPictureLossIndication and SendFullIntraRequest.

The split SetKeyFrameRequestMethod/RequestKeyFrame implicitly
requires that the two methods are called on the same thread, to avoid a
data race. After downstream code is updated, both deprecated
methods and the member |ModuleRtpRtcpImpl::key_frame_req_method_| can
be deleted.

Bug: None
Change-Id: I454f6d16b667f2306cba0dec467ddc183ad449c8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/140043
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28163}
diff --git a/modules/rtp_rtcp/include/rtp_rtcp.h b/modules/rtp_rtcp/include/rtp_rtcp.h
index 94c8250..18d1bdc 100644
--- a/modules/rtp_rtcp/include/rtp_rtcp.h
+++ b/modules/rtp_rtcp/include/rtp_rtcp.h
@@ -417,12 +417,21 @@
   // Video
   // **************************************************************************
 
+  // Requests new key frame.
+  // using PLI, https://tools.ietf.org/html/rfc4585#section-6.3.1.1
+  void SendPictureLossIndication() { SendRTCP(kRtcpPli); }
+  // using FIR, https://tools.ietf.org/html/rfc5104#section-4.3.1.2
+  void SendFullIntraRequest() { SendRTCP(kRtcpFir); }
+
   // Set method for requestion a new key frame.
   // Returns -1 on failure else 0.
+  RTC_DEPRECATED
   virtual int32_t SetKeyFrameRequestMethod(KeyFrameRequestMethod method) = 0;
 
   // Sends a request for a keyframe.
   // Returns -1 on failure else 0.
+  // Use above SendPictureLossIndication and SendFullIntraRequest instead.
+  RTC_DEPRECATED
   virtual int32_t RequestKeyFrame() = 0;
 
   // Sends a LossNotification RTCP message.
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index d575ba6..1d4861b 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -717,11 +717,13 @@
 int32_t ModuleRtpRtcpImpl::RequestKeyFrame() {
   switch (key_frame_req_method_) {
     case kKeyFrameReqPliRtcp:
-      return SendRTCP(kRtcpPli);
+      SendPictureLossIndication();
+      break;
     case kKeyFrameReqFirRtcp:
-      return SendRTCP(kRtcpFir);
+      SendFullIntraRequest();
+      break;
   }
-  return -1;
+  return 0;
 }
 
 int32_t ModuleRtpRtcpImpl::SendLossNotification(uint16_t last_decoded_seq_num,