mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 20:01:50 +00:00
Bug 1840150 - WebRTC backport: Video capture PipeWire: guard callback to avoid concurrent access r=jib,webrtc-reviewers,mjf
This is a simple backport of an WebRTC upstream change. Upstream commit: 666d707450eff6cc2946eba8edf67420f87ad11e Differential Revision: https://phabricator.services.mozilla.com/D184386
This commit is contained in:
parent
6f0f08186e
commit
8b485608f9
@ -232,7 +232,10 @@ PipeWireSession::~PipeWireSession() {
|
||||
}
|
||||
|
||||
void PipeWireSession::Init(VideoCaptureOptions::Callback* callback, int fd) {
|
||||
callback_ = callback;
|
||||
{
|
||||
webrtc::MutexLock lock(&callback_lock_);
|
||||
callback_ = callback;
|
||||
}
|
||||
|
||||
if (fd != -1) {
|
||||
InitPipeWire(fd);
|
||||
@ -374,6 +377,8 @@ void PipeWireSession::OnRegistryGlobalRemove(void* data, uint32_t id) {
|
||||
}
|
||||
|
||||
void PipeWireSession::Finish(VideoCaptureOptions::Status status) {
|
||||
webrtc::MutexLock lock(&callback_lock_);
|
||||
|
||||
if (callback_) {
|
||||
callback_->OnInitialized(status);
|
||||
callback_ = nullptr;
|
||||
@ -381,6 +386,9 @@ void PipeWireSession::Finish(VideoCaptureOptions::Status status) {
|
||||
}
|
||||
|
||||
void PipeWireSession::Cleanup() {
|
||||
webrtc::MutexLock lock(&callback_lock_);
|
||||
callback_ = nullptr;
|
||||
|
||||
StopPipeWire();
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "modules/video_capture/linux/camera_portal.h"
|
||||
#include "modules/video_capture/video_capture.h"
|
||||
#include "modules/video_capture/video_capture_options.h"
|
||||
#include "rtc_base/synchronization/mutex.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace videocapturemodule {
|
||||
@ -115,7 +116,9 @@ class PipeWireSession : public rtc::RefCountedNonVirtual<PipeWireSession> {
|
||||
void Finish(VideoCaptureOptions::Status status);
|
||||
void Cleanup();
|
||||
|
||||
VideoCaptureOptions::Callback* callback_ = nullptr;
|
||||
webrtc::Mutex callback_lock_;
|
||||
VideoCaptureOptions::Callback* callback_ RTC_GUARDED_BY(&callback_lock_) =
|
||||
nullptr;
|
||||
|
||||
struct pw_thread_loop* pw_main_loop_ = nullptr;
|
||||
struct pw_context* pw_context_ = nullptr;
|
||||
|
1
third_party/libwebrtc/moz-patch-stack/666d707450.no-op-cherry-pick-msg
vendored
Normal file
1
third_party/libwebrtc/moz-patch-stack/666d707450.no-op-cherry-pick-msg
vendored
Normal file
@ -0,0 +1 @@
|
||||
We cherry-picked this in bug 1840150.
|
Loading…
x
Reference in New Issue
Block a user