-diff --git a/modules/desktop_capture/screen_capturer_mac.mm b/modules/desktop_capture/screen_capturer_mac.mm
-index 6f2690f28..7d297f56e 100644
---- a/modules/desktop_capture/screen_capturer_mac.mm
-+++ b/modules/desktop_capture/screen_capturer_mac.mm
-@@ -36,6 +36,7 @@
- #include "rtc_base/macutils.h"
+diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm
+index df18777226..6a1e3da6ab 100644
+--- a/modules/desktop_capture/mac/screen_capturer_mac.mm
++++ b/modules/desktop_capture/mac/screen_capturer_mac.mm
+@@ -16,6 +16,7 @@
+ #include "rtc_base/checks.h"
+ #include "rtc_base/constructormagic.h"
+ #include "rtc_base/logging.h"
++#include "rtc_base/synchronization/rw_lock_wrapper.h"
  #include "rtc_base/timeutils.h"
  #include "sdk/objc/Framework/Classes/Common/scoped_cftyperef.h"
-+#include "system_wrappers/include/rw_lock_wrapper.h"
  
- namespace webrtc {
- 
-@@ -48,20 +49,32 @@ namespace {
+@@ -28,18 +29,31 @@ namespace webrtc {
  // destroy itself once it's done.
  class DisplayStreamManager {
   public:

+      finalize = ready_for_self_destruction_ && display_stream_wrappers_.empty();
+    }
+    if (finalize) {
       delete this;
+    }
   }
 
   void SaveStream(int unique_id,
                   CGDisplayStreamRef stream) {
+    WriteLockScoped scoped_display_stream_manager_lock(*rw_lock_);
     RTC_CHECK(unique_id <= unique_id_generator_);
     DisplayStreamWrapper wrapper;
     wrapper.stream = stream;
@@ -69,6 +82,7 @@ class DisplayStreamManager {
   }
 
   void UnregisterActiveStreams() {

+  DisplayStreamManager() : rw_lock_(RWLockWrapper::CreateRWLock()) {}
+  RWLockWrapper* GetLock() {return rw_lock_.get();};
 
-    if (ready_for_self_destruction_ && display_stream_wrappers_.empty()) delete this;
+  int GetUniqueId() {
+    WriteLockScoped scoped_display_stream_manager_lock(*rw_lock_);
+    return ++unique_id_generator_;
