From dd0094a2276cb8c4edb162b24d24229798c4b02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Tue, 4 Jun 2019 14:46:27 +0200 Subject: [PATCH] Deprecate RtpRtcp::SetKeyFrameRequestMethod MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Danil Chapovalov Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#28163} --- modules/rtp_rtcp/include/rtp_rtcp.h | 9 +++++++++ modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 8 +++++--- video/rtp_video_stream_receiver.cc | 3 +-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/modules/rtp_rtcp/include/rtp_rtcp.h b/modules/rtp_rtcp/include/rtp_rtcp.h index 94c8250aba..18d1bdcf07 100644 --- a/modules/rtp_rtcp/include/rtp_rtcp.h +++ b/modules/rtp_rtcp/include/rtp_rtcp.h @@ -417,12 +417,21 @@ class RtpRtcp : public Module, public RtcpFeedbackSenderInterface { // 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 d575ba6b68..1d4861b87c 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::SetKeyFrameRequestMethod( 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, diff --git a/video/rtp_video_stream_receiver.cc b/video/rtp_video_stream_receiver.cc index a8647c8e8e..668dfa45f6 100644 --- a/video/rtp_video_stream_receiver.cc +++ b/video/rtp_video_stream_receiver.cc @@ -209,7 +209,6 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver( rtp_rtcp_->SetRTCPStatus(config_.rtp.rtcp_mode); rtp_rtcp_->SetSSRC(config_.rtp.local_ssrc); rtp_rtcp_->SetRemoteSSRC(config_.rtp.remote_ssrc); - rtp_rtcp_->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp); static const int kMaxPacketAgeToNack = 450; const int max_reordering_threshold = (config_.rtp.nack.rtp_history_ms > 0) @@ -478,7 +477,7 @@ void RtpVideoStreamReceiver::RequestKeyFrame() { if (keyframe_request_sender_) { keyframe_request_sender_->RequestKeyFrame(); } else { - rtp_rtcp_->RequestKeyFrame(); + rtp_rtcp_->SendPictureLossIndication(); } }