From d23628dfb64a1329fed996f9302ae42ad5a9617f Mon Sep 17 00:00:00 2001 From: Tommi Date: Tue, 1 Jun 2021 09:49:03 +0200 Subject: [PATCH] Remove RecordingState::keyframe_needed. This variable is not used, always set to false but complicates things for `keyframe_generation_requested_` as setting keyframe_needed requires keyframe_generation_requested_ to be read synchronously from what soon will be a different thread than where SetAndGetRecordingState is called on. Bug: webrtc:11993 Change-Id: I25675d9b70c9ec96a2542e7cf5480c835ea984eb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/220840 Reviewed-by: Stefan Holmer Commit-Queue: Tommi Cr-Commit-Position: refs/heads/master@{#34188} --- call/video_receive_stream.h | 5 ----- video/video_receive_stream.cc | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h index 4a0a0dcae7..1bd8e946cc 100644 --- a/call/video_receive_stream.h +++ b/call/video_receive_stream.h @@ -53,11 +53,6 @@ class VideoReceiveStream { // Callback stored from the VideoReceiveStream. The VideoReceiveStream // client should not interpret the attribute. std::function callback; - // Memento of internal state in VideoReceiveStream, recording wether - // we're currently causing generation of a keyframe from the sender. Needed - // to avoid sending double keyframe requests. The VideoReceiveStream client - // should not interpret the attribute. - bool keyframe_needed = false; // Memento of when a keyframe request was last sent. The VideoReceiveStream // client should not interpret the attribute. absl::optional last_keyframe_request_ms; diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc index dbdba388aa..da8eb7de60 100644 --- a/video/video_receive_stream.cc +++ b/video/video_receive_stream.cc @@ -762,7 +762,6 @@ VideoReceiveStream::RecordingState VideoReceiveStream::SetAndGetRecordingState( RTC_DCHECK_RUN_ON(&decode_queue_); // Save old state. old_state.callback = std::move(encoded_frame_buffer_function_); - old_state.keyframe_needed = keyframe_generation_requested_; old_state.last_keyframe_request_ms = last_keyframe_request_ms_; // Set new state. @@ -771,7 +770,7 @@ VideoReceiveStream::RecordingState VideoReceiveStream::SetAndGetRecordingState( RequestKeyFrame(clock_->TimeInMilliseconds()); keyframe_generation_requested_ = true; } else { - keyframe_generation_requested_ = state.keyframe_needed; + keyframe_generation_requested_ = false; last_keyframe_request_ms_ = state.last_keyframe_request_ms.value_or(0); } event.Set();