diff --git a/media/base/video_adapter.cc b/media/base/video_adapter.cc index 27b82646ac..8ba91d7189 100644 --- a/media/base/video_adapter.cc +++ b/media/base/video_adapter.cc @@ -145,8 +145,6 @@ VideoAdapter::VideoAdapter() : VideoAdapter(1) {} VideoAdapter::~VideoAdapter() {} bool VideoAdapter::KeepFrame(int64_t in_timestamp_ns) { - rtc::CritScope cs(&critical_section_); - int max_fps = max_framerate_request_; if (max_fps_) max_fps = std::min(max_fps, *max_fps_); diff --git a/media/base/video_adapter.h b/media/base/video_adapter.h index 65c2d42267..b7acf0e67c 100644 --- a/media/base/video_adapter.h +++ b/media/base/video_adapter.h @@ -46,7 +46,8 @@ class VideoAdapter { int* cropped_width, int* cropped_height, int* out_width, - int* out_height); + int* out_height) + RTC_LOCKS_EXCLUDED(critical_section_); // DEPRECATED. Please use OnOutputFormatRequest below. // TODO(asapersson): Remove this once it is no longer used. @@ -57,7 +58,8 @@ class VideoAdapter { // maintain the input orientation, so it doesn't matter if e.g. 1280x720 or // 720x1280 is requested. // Note: Should be called from the source only. - void OnOutputFormatRequest(const absl::optional& format); + void OnOutputFormatRequest(const absl::optional& format) + RTC_LOCKS_EXCLUDED(critical_section_); // Requests output frame size and frame interval from |AdaptFrameResolution|. // |target_aspect_ratio|: The input frame size will be cropped to match the @@ -70,7 +72,7 @@ class VideoAdapter { void OnOutputFormatRequest( const absl::optional>& target_aspect_ratio, const absl::optional& max_pixel_count, - const absl::optional& max_fps); + const absl::optional& max_fps) RTC_LOCKS_EXCLUDED(critical_section_); // Same as above, but allows setting two different target aspect ratios // depending on incoming frame orientation. This gives more fine-grained @@ -81,7 +83,7 @@ class VideoAdapter { const absl::optional& max_landscape_pixel_count, const absl::optional>& target_portrait_aspect_ratio, const absl::optional& max_portrait_pixel_count, - const absl::optional& max_fps); + const absl::optional& max_fps) RTC_LOCKS_EXCLUDED(critical_section_); // Requests the output frame size from |AdaptFrameResolution| to have as close // as possible to |sink_wants.target_pixel_count| pixels (if set) @@ -93,11 +95,13 @@ class VideoAdapter { // The sink resolution alignment requirement is given by // |sink_wants.resolution_alignment|. // Note: Should be called from the sink only. - void OnSinkWants(const rtc::VideoSinkWants& sink_wants); + void OnSinkWants(const rtc::VideoSinkWants& sink_wants) + RTC_LOCKS_EXCLUDED(critical_section_); private: // Determine if frame should be dropped based on input fps and requested fps. - bool KeepFrame(int64_t in_timestamp_ns); + bool KeepFrame(int64_t in_timestamp_ns) + RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_); int frames_in_ RTC_GUARDED_BY(critical_section_); // Number of input frames. int frames_out_