From f11a798b39ae71b62ba299aa173b39fe5329070f Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Sat, 28 Nov 2020 10:09:12 +0100 Subject: Added fix for mzbz#1678680 --- mozilla-1678680.patch | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 mozilla-1678680.patch (limited to 'mozilla-1678680.patch') diff --git a/mozilla-1678680.patch b/mozilla-1678680.patch new file mode 100644 index 0000000..5c4953a --- /dev/null +++ b/mozilla-1678680.patch @@ -0,0 +1,73 @@ +changeset: 560838:7a5a1784b5d1 +tag: tip +parent: 560835:7184fb5a42fb +user: Martin Stransky +date: Fri Nov 27 17:29:07 2020 +0100 +files: third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h +description: +Bug 1678680 [PipeWire] Lock current_frame_ access as it can be used from multiple threads, r?dminor + +Differential Revision: https://phabricator.services.mozilla.com/D98080 + + +diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc +--- a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc ++++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc +@@ -396,16 +396,17 @@ void BaseCapturerPipeWire::HandleBuffer( + DesktopSize video_size_prev = video_size_; + if (video_metadata_use_) { + video_size_ = DesktopSize(video_metadata->region.size.width, + video_metadata->region.size.height); + } else { + video_size_ = desktop_size_; + } + ++ rtc::CritScope lock(¤t_frame_lock_); + if (!current_frame_ || + (video_metadata_use_ && !video_size_.equals(video_size_prev))) { + current_frame_ = + std::make_unique + (video_size_.width() * video_size_.height() * kBytesPerPixel); + } + + const int32_t dstStride = video_size_.width() * kBytesPerPixel; +@@ -872,16 +873,17 @@ void BaseCapturerPipeWire::Start(Callbac + } + + void BaseCapturerPipeWire::CaptureFrame() { + if (portal_init_failed_) { + callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); + return; + } + ++ rtc::CritScope lock(¤t_frame_lock_); + if (!current_frame_) { + callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); + return; + } + + DesktopSize frame_size = desktop_size_; + if (video_metadata_use_) { + frame_size = video_size_; +diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h +--- a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h ++++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h +@@ -79,16 +79,17 @@ class BaseCapturerPipeWire : public Desk + guint sources_request_signal_id_ = 0; + guint start_request_signal_id_ = 0; + + bool video_metadata_use_ = false; + DesktopSize video_size_; + DesktopSize desktop_size_ = {}; + DesktopCaptureOptions options_ = {}; + ++ rtc::CriticalSection current_frame_lock_; + std::unique_ptr current_frame_; + Callback* callback_ = nullptr; + + bool portal_init_failed_ = false; + + void InitPortal(); + void InitPipeWire(); + + -- cgit