Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm

Issue 2372513004: Remove Crit::Scope lock by using atomic bool property (Closed)
Patch Set: Re-add instance variable and manually synthesize it. - It's an agreed way of defining properties i… Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/sdk/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm
diff --git a/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm b/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm
index 5708346ae2bccdee06da02c5eea8d2a13d37d453..ba1c4d7cb3abb9b92052da7a09c53dfad44f85d8 100644
--- a/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm
+++ b/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm
@@ -78,7 +78,7 @@ static NSString *GetSessionPresetForVideoFormat(
@property(nonatomic, readonly) dispatch_queue_t frameQueue;
@property(nonatomic, readonly) BOOL canUseBackCamera;
@property(nonatomic, assign) BOOL useBackCamera; // Defaults to NO.
-@property(nonatomic, assign) BOOL isRunning; // Whether the capture session is running.
+@property(atomic, assign) BOOL isRunning; // Whether the capture session is running.
@property(atomic, assign) BOOL hasStarted; // Whether we have an unmatched start.
// We keep a pointer back to AVFoundationVideoCapturer to make callbacks on it
@@ -111,6 +111,8 @@ static NSString *GetSessionPresetForVideoFormat(
@synthesize captureSession = _captureSession;
@synthesize frameQueue = _frameQueue;
@synthesize useBackCamera = _useBackCamera;
+
+@synthesize isRunning = _isRunning;
@synthesize hasStarted = _hasStarted;
// This is called from the thread that creates the video source, which is likely
@@ -217,16 +219,6 @@ static NSString *GetSessionPresetForVideoFormat(
}
}
-- (BOOL)isRunning {
- rtc::CritScope cs(&_crit);
- return _isRunning;
-}
-
-- (void)setIsRunning:(BOOL)isRunning {
- rtc::CritScope cs(&_crit);
- _isRunning = isRunning;
-}
-
// Called from WebRTC thread.
- (void)start {
if (self.hasStarted) {
@@ -354,6 +346,7 @@ static NSString *GetSessionPresetForVideoFormat(
- (void)handleCaptureSessionDidStartRunning:(NSNotification *)notification {
RTCLog(@"Capture session started.");
+
self.isRunning = YES;
[RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeCaptureSession
block:^{
« no previous file with comments | « webrtc/sdk/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698