diff --git a/call/adaptation/resource_adaptation_module_interface.h b/call/adaptation/resource_adaptation_module_interface.h index 623a414324..7bfe24f4f4 100644 --- a/call/adaptation/resource_adaptation_module_interface.h +++ b/call/adaptation/resource_adaptation_module_interface.h @@ -119,15 +119,7 @@ class ResourceAdaptationModuleInterface { // TODO(hbos): If we take frame rate into account perhaps it would be valid to // adapt down in frame rate as well. virtual void OnFrameDroppedDueToSize() = 0; - // 2.ii) If the frame will not be dropped due to size then signal that it may - // get encoded. However the frame is not guaranteed to be encoded right away - // or ever (for example if encoding is paused). - // TODO(eshr): Try replace OnMaybeEncodeFrame and merge behaviour into - // EncodeStarted. - // TODO(eshr): Try to merge OnFrame, OnFrameDroppedDueToSize, and - // OnMaybeEncode frame into one method. - virtual void OnMaybeEncodeFrame() = 0; - // 2.iii) An input frame is about to be encoded. It may have been cropped and + // 2.ii) An input frame is about to be encoded. It may have been cropped and // have different dimensions than what was observed at OnFrame(). Next // up: encoding completes or fails, see OnEncodeCompleted(). There is // currently no signal for encode failure. diff --git a/video/overuse_frame_detector_resource_adaptation_module.cc b/video/overuse_frame_detector_resource_adaptation_module.cc index 9cbd79c392..2a63c4e1b6 100644 --- a/video/overuse_frame_detector_resource_adaptation_module.cc +++ b/video/overuse_frame_detector_resource_adaptation_module.cc @@ -367,7 +367,7 @@ class OveruseFrameDetectorResourceAdaptationModule::InitialFrameDropper { void OnFrameDroppedDueToSize() { ++initial_framedrop_; } - void OnMaybeEncodeFrame() { initial_framedrop_ = kMaxInitialFramedrop; } + void OnEncodeStarted() { initial_framedrop_ = kMaxInitialFramedrop; } void OnQualityScalerSettingsUpdated() { if (quality_scaler_resource_->is_started()) { @@ -536,6 +536,8 @@ void OveruseFrameDetectorResourceAdaptationModule::OnFrameDroppedDueToSize() { void OveruseFrameDetectorResourceAdaptationModule::OnEncodeStarted( const VideoFrame& cropped_frame, int64_t time_when_first_seen_us) { + initial_frame_dropper_->OnEncodeStarted(); + MaybePerformQualityRampupExperiment(); encode_usage_resource_->OnEncodeStarted(cropped_frame, time_when_first_seen_us); } @@ -563,11 +565,6 @@ bool OveruseFrameDetectorResourceAdaptationModule::DropInitialFrames() const { return initial_frame_dropper_->DropInitialFrames(); } -void OveruseFrameDetectorResourceAdaptationModule::OnMaybeEncodeFrame() { - initial_frame_dropper_->OnMaybeEncodeFrame(); - MaybePerformQualityRampupExperiment(); -} - void OveruseFrameDetectorResourceAdaptationModule::UpdateQualityScalerSettings( absl::optional qp_thresholds) { if (qp_thresholds.has_value()) { diff --git a/video/overuse_frame_detector_resource_adaptation_module.h b/video/overuse_frame_detector_resource_adaptation_module.h index d10b8c111c..ecb990f4b6 100644 --- a/video/overuse_frame_detector_resource_adaptation_module.h +++ b/video/overuse_frame_detector_resource_adaptation_module.h @@ -86,7 +86,6 @@ class OveruseFrameDetectorResourceAdaptationModule void OnFrame(const VideoFrame& frame) override; void OnFrameDroppedDueToSize() override; - void OnMaybeEncodeFrame() override; void OnEncodeStarted(const VideoFrame& cropped_frame, int64_t time_when_first_seen_us) override; void OnEncodeCompleted(const EncodedImage& encoded_image, diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index 8c9204f041..5a06499862 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -1079,7 +1079,6 @@ void VideoStreamEncoder::MaybeEncodeVideoFrame(const VideoFrame& video_frame, } return; } - resource_adaptation_module_->OnMaybeEncodeFrame(); if (EncoderPaused()) { // Storing references to a native buffer risks blocking frame capture.