[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser] 08/09: Bug 1786502 - Lock access to DeviceInfo devicechange callbacks. r=webrtc-reviewers, jib a=RyanVM
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.13.0esr-11.5-1
in repository tor-browser.
commit 1b2bdfec0911435074f8e3d5f360c886c195c2f2
Author: Andreas Pehrson <apehrson@xxxxxxxxxxx>
AuthorDate: Mon Sep 5 13:56:11 2022 +0000
Bug 1786502 - Lock access to DeviceInfo devicechange callbacks. r=webrtc-reviewers,jib a=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D155365
---
dom/media/systemservices/CamerasParent.h | 2 +-
.../libwebrtc/webrtc/modules/video_capture/video_capture.h | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dom/media/systemservices/CamerasParent.h b/dom/media/systemservices/CamerasParent.h
index adf85e176eb7..d29664d1c458 100644
--- a/dom/media/systemservices/CamerasParent.h
+++ b/dom/media/systemservices/CamerasParent.h
@@ -62,7 +62,7 @@ class InputObserver : public webrtc::VideoInputFeedBack {
private:
~InputObserver() = default;
- RefPtr<CamerasParent> mParent;
+ const RefPtr<CamerasParent> mParent;
};
class CamerasParent final : public PCamerasParent,
diff --git a/third_party/libwebrtc/webrtc/modules/video_capture/video_capture.h b/third_party/libwebrtc/webrtc/modules/video_capture/video_capture.h
index 11c880baa772..2ae33fba98a8 100644
--- a/third_party/libwebrtc/webrtc/modules/video_capture/video_capture.h
+++ b/third_party/libwebrtc/webrtc/modules/video_capture/video_capture.h
@@ -16,6 +16,8 @@
#include "media/base/videosinkinterface.h"
#include "modules/include/module.h"
#include "modules/video_capture/video_capture_defines.h"
+#include "rtc_base/synchronization/mutex.h"
+#include "rtc_base/thread_annotations.h"
#include <set>
#if defined(ANDROID)
@@ -81,15 +83,18 @@ class VideoCaptureModule: public rtc::RefCountInterface {
virtual uint32_t NumberOfDevices() = 0;
virtual int32_t Refresh() = 0;
virtual void DeviceChange() {
+ MutexLock lock(&_inputCallbacksMutex);
for (auto inputCallBack : _inputCallBacks) {
inputCallBack->OnDeviceChange();
}
}
virtual void RegisterVideoInputFeedBack(VideoInputFeedBack* callBack) {
+ MutexLock lock(&_inputCallbacksMutex);
_inputCallBacks.insert(callBack);
}
virtual void DeRegisterVideoInputFeedBack(VideoInputFeedBack* callBack) {
+ MutexLock lock(&_inputCallbacksMutex);
auto it = _inputCallBacks.find(callBack);
if (it != _inputCallBacks.end()) {
_inputCallBacks.erase(it);
@@ -147,7 +152,8 @@ class VideoCaptureModule: public rtc::RefCountInterface {
virtual ~DeviceInfo() {}
private:
- std::set<VideoInputFeedBack*> _inputCallBacks;
+ Mutex _inputCallbacksMutex;
+ std::set<VideoInputFeedBack*> _inputCallBacks RTC_GUARDED_BY(_inputCallbacksMutex);
};
// Register capture data callback
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits