From 4186603902fc0bbcfb676b5e79fd004ace1f7049 Mon Sep 17 00:00:00 2001 From: Markus Handell Date: Mon, 18 Nov 2019 11:10:11 +0100 Subject: [PATCH] Always record timestamp of keyframe request. Bug: chromium:1013590 Change-Id: I85b20f06cb0bec15dae199cf96512173f0faad42 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159884 Commit-Queue: Markus Handell Reviewed-by: Ilya Nikolaevskiy Cr-Commit-Position: refs/heads/master@{#29817} --- video/video_receive_stream.cc | 10 +++++----- video/video_receive_stream.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc index a60bb07911..a683f7ddb5 100644 --- a/video/video_receive_stream.cc +++ b/video/video_receive_stream.cc @@ -535,12 +535,13 @@ void VideoReceiveStream::SendNack(const std::vector& sequence_numbers, rtp_video_stream_receiver_.RequestPacketRetransmit(sequence_numbers); } -void VideoReceiveStream::RequestKeyFrame() { +void VideoReceiveStream::RequestKeyFrame(int64_t timestamp_ms) { if (config_.media_transport()) { config_.media_transport()->RequestKeyFrame(config_.rtp.remote_ssrc); } else { rtp_video_stream_receiver_.RequestKeyFrame(); } + last_keyframe_request_ms_ = timestamp_ms; } void VideoReceiveStream::OnCompleteFrame( @@ -672,14 +673,13 @@ void VideoReceiveStream::HandleEncodedFrame( rtp_video_stream_receiver_.FrameDecoded(frame->id.picture_id); if (decode_result == WEBRTC_VIDEO_CODEC_OK_REQUEST_KEYFRAME) - RequestKeyFrame(); + RequestKeyFrame(now_ms); } else if (!frame_decoded_ || !keyframe_required_ || (last_keyframe_request_ms_ + max_wait_for_keyframe_ms_ < now_ms)) { keyframe_required_ = true; // TODO(philipel): Remove this keyframe request when downstream project // has been fixed. - RequestKeyFrame(); - last_keyframe_request_ms_ = now_ms; + RequestKeyFrame(now_ms); } } @@ -707,7 +707,7 @@ void VideoReceiveStream::HandleFrameBufferTimeout() { rtp_video_stream_receiver_.IsDecryptable())) { RTC_LOG(LS_WARNING) << "No decodable frame in " << GetWaitMs() << " ms, requesting keyframe."; - RequestKeyFrame(); + RequestKeyFrame(now_ms); } } diff --git a/video/video_receive_stream.h b/video/video_receive_stream.h index e72c3b1be8..7c6856381a 100644 --- a/video/video_receive_stream.h +++ b/video/video_receive_stream.h @@ -142,7 +142,7 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream, void UpdatePlayoutDelays() const RTC_EXCLUSIVE_LOCKS_REQUIRED(playout_delay_lock_); - void RequestKeyFrame(); + void RequestKeyFrame(int64_t timestamp_ms); void UpdateHistograms();