Add a way to set keyframe request method on VideoReceiveStream

This patch adds a method for setting the keyframe request method
to VideoReceiveStream.

This code exists in the version that Mozilla is shipping, with a review
https://phabricator.services.mozilla.com/D105773 .

Bug: webrtc:13486
Change-Id: I7cc19dec95d6523368d73395319854bd8c2166f7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/240140
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35793}
This commit is contained in:
Nico Grunbaum
2021-12-08 20:59:31 -08:00
committed by WebRTC LUCI CQ
parent 8a09610219
commit a36f10bd73
4 changed files with 15 additions and 1 deletions

View File

@ -191,6 +191,10 @@ class VideoReceiveStream : public MediaReceiveStream {
bool receiver_reference_time_report = false;
} rtcp_xr;
// How to request keyframes from a remote sender. Applies only if lntf is
// disabled.
KeyFrameReqMethod keyframe_method = KeyFrameReqMethod::kPliRtcp;
// See LntfConfig for description.
LntfConfig lntf;

View File

@ -103,6 +103,12 @@ enum RTCPPacketType : uint32_t {
kRtcpXrTargetBitrate = 0x200000
};
enum class KeyFrameReqMethod : uint8_t {
kNone, // Don't request keyframes.
kPliRtcp, // Request keyframes through Picture Loss Indication.
kFirRtcp // Request keyframes through Full Intra-frame Request.
};
enum RtxMode {
kRtxOff = 0x0,
kRtxRetransmitted = 0x1, // Only send retransmissions over RTX.

View File

@ -242,6 +242,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
config_.rtp.local_ssrc)),
complete_frame_callback_(complete_frame_callback),
keyframe_request_sender_(keyframe_request_sender),
keyframe_request_method_(config_.rtp.keyframe_method),
// TODO(bugs.webrtc.org/10336): Let `rtcp_feedback_buffer_` communicate
// directly with `rtp_rtcp_`.
rtcp_feedback_buffer_(this, nack_sender, this),
@ -671,8 +672,10 @@ void RtpVideoStreamReceiver2::RequestKeyFrame() {
// sender) is relying on LNTF alone.
if (keyframe_request_sender_) {
keyframe_request_sender_->RequestKeyFrame();
} else {
} else if (keyframe_request_method_ == KeyFrameReqMethod::kPliRtcp) {
rtp_rtcp_->SendPictureLossIndication();
} else if (keyframe_request_method_ == KeyFrameReqMethod::kFirRtcp) {
rtp_rtcp_->SendFullIntraRequest();
}
}

View File

@ -319,6 +319,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
OnCompleteFrameCallback* complete_frame_callback_;
KeyFrameRequestSender* const keyframe_request_sender_;
const KeyFrameReqMethod keyframe_request_method_;
RtcpFeedbackBuffer rtcp_feedback_buffer_;
const std::unique_ptr<NackRequester> nack_module_;