summaryrefslogtreecommitdiff
path: root/mozilla-1678680.patch
diff options
context:
space:
mode:
Diffstat (limited to 'mozilla-1678680.patch')
-rw-r--r--mozilla-1678680.patch73
1 files changed, 73 insertions, 0 deletions
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 <stransky@redhat.com>
+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(&current_frame_lock_);
+ if (!current_frame_ ||
+ (video_metadata_use_ && !video_size_.equals(video_size_prev))) {
+ current_frame_ =
+ std::make_unique<uint8_t[]>
+ (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(&current_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<uint8_t[]> current_frame_;
+ Callback* callback_ = nullptr;
+
+ bool portal_init_failed_ = false;
+
+ void InitPortal();
+ void InitPipeWire();
+
+
bgstack15