diff --git a/test/frame_generator_capturer.cc b/test/frame_generator_capturer.cc index d30909d8ed..b53085b7c4 100644 --- a/test/frame_generator_capturer.cc +++ b/test/frame_generator_capturer.cc @@ -94,7 +94,7 @@ void FrameGeneratorCapturer::InsertFrame() { if (sending_) { FrameGeneratorInterface::VideoFrameData frame_data = frame_generator_->NextFrame(); - // TODO(srte): Use more advanced frame rate control to allow arbritrary + // TODO(srte): Use more advanced frame rate control to allow arbitrary // fractions. int decimation = std::round(static_cast(source_fps_) / target_capture_fps_); @@ -189,28 +189,20 @@ void FrameGeneratorCapturer::AddOrUpdateSink( rtc::VideoSinkInterface* sink, const rtc::VideoSinkWants& wants) { TestVideoCapturer::AddOrUpdateSink(sink, wants); - MutexLock lock(&lock_); - if (sink_wants_observer_) { - // Tests need to observe unmodified sink wants. - sink_wants_observer_->OnSinkWantsChanged(sink, wants); + { + MutexLock lock(&lock_); + if (sink_wants_observer_) { + // Tests need to observe unmodified sink wants. + sink_wants_observer_->OnSinkWantsChanged(sink, wants); + } } - UpdateFps(GetSinkWants().max_framerate_fps); + ChangeFramerate(GetSinkWants().max_framerate_fps); } void FrameGeneratorCapturer::RemoveSink( rtc::VideoSinkInterface* sink) { TestVideoCapturer::RemoveSink(sink); - - MutexLock lock(&lock_); - UpdateFps(GetSinkWants().max_framerate_fps); -} - -void FrameGeneratorCapturer::UpdateFps(int max_fps) { - if (max_fps < target_capture_fps_) { - wanted_fps_.emplace(max_fps); - } else { - wanted_fps_.reset(); - } + ChangeFramerate(GetSinkWants().max_framerate_fps); } void FrameGeneratorCapturer::ForceFrame() { @@ -220,8 +212,6 @@ void FrameGeneratorCapturer::ForceFrame() { int FrameGeneratorCapturer::GetCurrentConfiguredFramerate() { MutexLock lock(&lock_); - if (wanted_fps_ && *wanted_fps_ < target_capture_fps_) - return *wanted_fps_; return target_capture_fps_; } diff --git a/test/frame_generator_capturer.h b/test/frame_generator_capturer.h index 0a46a2f283..c1d01300d2 100644 --- a/test/frame_generator_capturer.h +++ b/test/frame_generator_capturer.h @@ -86,7 +86,6 @@ class FrameGeneratorCapturer : public TestVideoCapturer { void InsertFrame(); static bool Run(void* obj); int GetCurrentConfiguredFramerate(); - void UpdateFps(int max_fps) RTC_EXCLUSIVE_LOCKS_REQUIRED(&lock_); Clock* const clock_; RepeatingTaskHandle frame_task_; @@ -98,7 +97,6 @@ class FrameGeneratorCapturer : public TestVideoCapturer { int source_fps_ RTC_GUARDED_BY(&lock_); int target_capture_fps_ RTC_GUARDED_BY(&lock_); - absl::optional wanted_fps_ RTC_GUARDED_BY(&lock_); VideoRotation fake_rotation_ = kVideoRotation_0; absl::optional fake_color_space_ RTC_GUARDED_BY(&lock_);