diff options
Diffstat (limited to 'third_party/libwebrtc/moz-patch-stack/0104.patch')
-rw-r--r-- | third_party/libwebrtc/moz-patch-stack/0104.patch | 95 |
1 files changed, 65 insertions, 30 deletions
diff --git a/third_party/libwebrtc/moz-patch-stack/0104.patch b/third_party/libwebrtc/moz-patch-stack/0104.patch index a6da56ee72..fd05008507 100644 --- a/third_party/libwebrtc/moz-patch-stack/0104.patch +++ b/third_party/libwebrtc/moz-patch-stack/0104.patch @@ -1,33 +1,68 @@ -From: Andreas Pehrson <apehrson@mozilla.com> -Date: Fri, 2 Feb 2024 18:43:00 +0000 -Subject: Bug 1878010 - Fix webrtc::VideoCaptureFactory for BSD. - r=grulja,gaston,webrtc-reviewers,mjf +From: Jan Grulich <jgrulich@redhat.com> +Date: Fri, 2 Feb 2024 11:47:00 +0000 +Subject: Bug 1876896 - WebRTC backport: Allow VideoCaptureModulePipeWire to be + shared with more consumers r=pehrsons,webrtc-reviewers -Differential Revision: https://phabricator.services.mozilla.com/D200427 -Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/f890637efe5abc0020fab83ff2224313cd0c8460 +This is a simple backport of an WebRTC upstream change. + +Upstream commit: 958c9ac546f33716d097b5092515dcac705151d3 + +Differential Revision: https://phabricator.services.mozilla.com/D200142 +Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/2ba2ef65280b2e6f246fed24d6986718981744f5 --- - modules/video_capture/video_capture_factory.cc | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + .../video_capture/linux/video_capture_pipewire.cc | 15 ++++++++++++++- + .../video_capture/linux/video_capture_pipewire.h | 1 + + 2 files changed, 15 insertions(+), 1 deletion(-) -diff --git a/modules/video_capture/video_capture_factory.cc b/modules/video_capture/video_capture_factory.cc -index e085ac2df8..2790fbbe1c 100644 ---- a/modules/video_capture/video_capture_factory.cc -+++ b/modules/video_capture/video_capture_factory.cc -@@ -24,7 +24,7 @@ rtc::scoped_refptr<VideoCaptureModule> VideoCaptureFactory::Create( - const char* deviceUniqueIdUTF8) { - // This is only implemented on pure Linux and WEBRTC_LINUX is defined for - // Android as well --#if !defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) -+#if (!defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD)) || defined(WEBRTC_ANDROID) - return nullptr; - #else - return videocapturemodule::VideoCaptureImpl::Create(options, -@@ -40,7 +40,7 @@ VideoCaptureModule::DeviceInfo* VideoCaptureFactory::CreateDeviceInfo( - VideoCaptureOptions* options) { - // This is only implemented on pure Linux and WEBRTC_LINUX is defined for - // Android as well --#if !defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) -+#if (!defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD)) || defined(WEBRTC_ANDROID) - return nullptr; - #else - return videocapturemodule::VideoCaptureImpl::CreateDeviceInfo(options); +diff --git a/modules/video_capture/linux/video_capture_pipewire.cc b/modules/video_capture/linux/video_capture_pipewire.cc +index 9d47e3ddbf..fb813e331f 100644 +--- a/modules/video_capture/linux/video_capture_pipewire.cc ++++ b/modules/video_capture/linux/video_capture_pipewire.cc +@@ -48,7 +48,10 @@ VideoType VideoCaptureModulePipeWire::PipeWireRawFormatToVideoType( + + VideoCaptureModulePipeWire::VideoCaptureModulePipeWire( + VideoCaptureOptions* options) +- : VideoCaptureImpl(), session_(options->pipewire_session()) {} ++ : VideoCaptureImpl(), ++ session_(options->pipewire_session()), ++ initialized_(false), ++ started_(false) {} + + VideoCaptureModulePipeWire::~VideoCaptureModulePipeWire() { + RTC_DCHECK_RUN_ON(&api_checker_); +@@ -121,6 +124,14 @@ int32_t VideoCaptureModulePipeWire::StartCapture( + RTC_CHECK_RUNS_SERIALIZED(&capture_checker_); + RTC_DCHECK_RUN_ON(&api_checker_); + ++ if (initialized_) { ++ if (capability == _requestedCapability) { ++ return 0; ++ } else { ++ StopCapture(); ++ } ++ } ++ + uint8_t buffer[1024] = {}; + + RTC_LOG(LS_VERBOSE) << "Creating new PipeWire stream for node " << node_id_; +@@ -171,6 +182,8 @@ int32_t VideoCaptureModulePipeWire::StartCapture( + } + + _requestedCapability = capability; ++ initialized_ = true; ++ + return 0; + } + +diff --git a/modules/video_capture/linux/video_capture_pipewire.h b/modules/video_capture/linux/video_capture_pipewire.h +index 620ee520ca..5d6794ed65 100644 +--- a/modules/video_capture/linux/video_capture_pipewire.h ++++ b/modules/video_capture/linux/video_capture_pipewire.h +@@ -50,6 +50,7 @@ class VideoCaptureModulePipeWire : public VideoCaptureImpl { + int node_id_ RTC_GUARDED_BY(capture_checker_); + VideoCaptureCapability configured_capability_ + RTC_GUARDED_BY(pipewire_checker_); ++ bool initialized_ RTC_GUARDED_BY(capture_checker_); + bool started_ RTC_GUARDED_BY(api_lock_); + + struct pw_stream* stream_ RTC_GUARDED_BY(pipewire_checker_) = nullptr; |