Make KeyFrameRequestSender injectable in RtpVideoStreamReceiver

This is a partial revert of
https://webrtc-review.googlesource.com/c/src/+/130101.

The KeyFrameRequestSender argument is added back to the constructor of
RtpVideoStreamReceiver. It is optional; if a null pointer is passed,
key frame requests are sent via the internal RtpRtcp module, and this is
how the class is used by VideoReceiveStream. An injectable
KeyFrameRequestSender is useful for tests, for downstream applications
that want to route key frame requests elsewhere, and should also aid
later migration to RtcpTransciever.

Bug: None
Change-Id: Idf9baeed21570625ad74e9afbe38f7ea5bf79feb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/139107
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28102}
This commit is contained in:
Niels Möller
2019-05-29 13:35:14 +02:00
committed by Commit Bot
parent e8e7d7b0bc
commit 2f5554dae5
4 changed files with 23 additions and 59 deletions

View File

@ -85,32 +85,7 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver(
ReceiveStatisticsProxy* receive_stats_proxy,
ProcessThread* process_thread,
NackSender* nack_sender,
video_coding::OnCompleteFrameCallback* complete_frame_callback,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor)
: RtpVideoStreamReceiver(clock,
CreateRtpRtcpModule(clock,
rtp_receive_statistics,
transport,
rtt_stats,
receive_stats_proxy),
packet_router,
config,
rtp_receive_statistics,
receive_stats_proxy,
process_thread,
nack_sender,
complete_frame_callback,
frame_decryptor) {}
RtpVideoStreamReceiver::RtpVideoStreamReceiver(
Clock* clock,
std::unique_ptr<RtpRtcp> rtp_rtcp,
PacketRouter* packet_router,
const VideoReceiveStream::Config* config,
ReceiveStatistics* rtp_receive_statistics,
ReceiveStatisticsProxy* receive_stats_proxy,
ProcessThread* process_thread,
NackSender* nack_sender,
KeyFrameRequestSender* keyframe_request_sender,
video_coding::OnCompleteFrameCallback* complete_frame_callback,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor)
: clock_(clock),
@ -123,8 +98,13 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver(
ulpfec_receiver_(UlpfecReceiver::Create(config->rtp.remote_ssrc, this)),
receiving_(false),
last_packet_log_ms_(-1),
rtp_rtcp_(std::move(rtp_rtcp)),
rtp_rtcp_(CreateRtpRtcpModule(clock,
rtp_receive_statistics_,
transport,
rtt_stats,
receive_stats_proxy)),
complete_frame_callback_(complete_frame_callback),
keyframe_request_sender_(keyframe_request_sender),
has_received_frame_(false),
frames_decryptable_(false) {
constexpr bool remb_candidate = true;
@ -400,7 +380,11 @@ void RtpVideoStreamReceiver::OnRtpPacket(const RtpPacketReceived& packet) {
}
void RtpVideoStreamReceiver::RequestKeyFrame() {
rtp_rtcp_->RequestKeyFrame();
if (keyframe_request_sender_) {
keyframe_request_sender_->RequestKeyFrame();
} else {
rtp_rtcp_->RequestKeyFrame();
}
}
void RtpVideoStreamReceiver::SendLossNotification(