[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser] 56/73: 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 geckoview-102.3.0esr-12.0-1
in repository tor-browser.
commit b7c7929228f0ee91dce50fabffb35f7474237ef3
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 +-
third_party/libwebrtc/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 37fc93326357b..f48f88b23e85c 100644
--- a/dom/media/systemservices/CamerasParent.h
+++ b/dom/media/systemservices/CamerasParent.h
@@ -56,7 +56,7 @@ class InputObserver : public webrtc::VideoInputFeedBack {
private:
~InputObserver() = default;
- RefPtr<CamerasParent> mParent;
+ const RefPtr<CamerasParent> mParent;
};
class DeliverFrameRunnable;
diff --git a/third_party/libwebrtc/modules/video_capture/video_capture.h b/third_party/libwebrtc/modules/video_capture/video_capture.h
index 64c55f0a4ef51..6866799b11652 100644
--- a/third_party/libwebrtc/modules/video_capture/video_capture.h
+++ b/third_party/libwebrtc/modules/video_capture/video_capture.h
@@ -17,6 +17,8 @@
#include "modules/include/module.h"
#include "modules/desktop_capture/desktop_capture_types.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)
@@ -82,15 +84,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);
@@ -144,7 +149,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