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

Unified Diff: webrtc/sdk/objc/Framework/Classes/RTCAVFoundationVideoCapturerInternal.h

Issue 2488973002: Split avfoundationcapturer classes in separate files. (Closed)
Patch Set: Decrease the similarity to 10% Created 4 years, 1 month 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
Index: webrtc/sdk/objc/Framework/Classes/RTCAVFoundationVideoCapturerInternal.h
diff --git a/webrtc/sdk/objc/Framework/Headers/WebRTC/RTCAVFoundationVideoSource.h b/webrtc/sdk/objc/Framework/Classes/RTCAVFoundationVideoCapturerInternal.h
similarity index 26%
copy from webrtc/sdk/objc/Framework/Headers/WebRTC/RTCAVFoundationVideoSource.h
copy to webrtc/sdk/objc/Framework/Classes/RTCAVFoundationVideoCapturerInternal.h
index 2a732b9686b877644541814da1d6a025611362d3..cce2580629a60b6f4ac547017b1b4a2c12ab1030 100644
--- a/webrtc/sdk/objc/Framework/Headers/WebRTC/RTCAVFoundationVideoSource.h
+++ b/webrtc/sdk/objc/Framework/Classes/RTCAVFoundationVideoCapturerInternal.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 The WebRTC project authors. All Rights Reserved.
+ * Copyright 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@@ -8,36 +8,39 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#import <WebRTC/RTCMacros.h>
-#import <WebRTC/RTCVideoSource.h>
+#import <Foundation/Foundation.h>
+#import <AVFoundation/AVFoundation.h>
-@class AVCaptureSession;
-@class RTCMediaConstraints;
-@class RTCPeerConnectionFactory;
+#include "avfoundationvideocapturer.h"
NS_ASSUME_NONNULL_BEGIN
+// This class used to capture frames using AVFoundation APIs on iOS. It is meant
+// to be owned by an instance of AVFoundationVideoCapturer. The reason for this
+// because other webrtc objects own cricket::VideoCapturer, which is not
+// ref counted. To prevent bad behavior we do not expose this class directly.
+@interface RTCAVFoundationVideoCapturerInternal
+ : NSObject<AVCaptureVideoDataOutputSampleBufferDelegate>
-/**
- * RTCAVFoundationVideoSource is a video source that uses
- * webrtc::AVFoundationVideoCapturer. We do not currently provide a wrapper for
- * that capturer because cricket::VideoCapturer is not ref counted and we cannot
- * guarantee its lifetime. Instead, we expose its properties through the ref
- * counted video source interface.
- */
-RTC_EXPORT
-@interface RTCAVFoundationVideoSource : RTCVideoSource
-
-- (instancetype)init NS_UNAVAILABLE;
-
-/** Returns whether rear-facing camera is available for use. */
+@property(nonatomic, readonly) AVCaptureSession *captureSession;
+@property(nonatomic, readonly) dispatch_queue_t frameQueue;
@property(nonatomic, readonly) BOOL canUseBackCamera;
+@property(nonatomic, assign) BOOL useBackCamera; // Defaults to NO.
+@property(atomic, assign) BOOL isRunning; // Whether the capture session is running.
+@property(atomic, assign) BOOL hasStarted; // Whether we have an unmatched start.
-/** Switches the camera being used (either front or back). */
-@property(nonatomic, assign) BOOL useBackCamera;
+// We keep a pointer back to AVFoundationVideoCapturer to make callbacks on it
+// when we receive frames. This is safe because this object should be owned by
+// it.
+- (instancetype)initWithCapturer:(webrtc::AVFoundationVideoCapturer *)capturer;
+- (AVCaptureDevice *)getActiveCaptureDevice;
-/** Returns the active capture session. */
-@property(nonatomic, readonly) AVCaptureSession *captureSession;
+- (nullable AVCaptureDevice *)frontCaptureDevice;
+- (nullable AVCaptureDevice *)backCaptureDevice;
-@end
+// Starts and stops the capture session asynchronously. We cannot do this
+// synchronously without blocking a WebRTC thread.
+- (void)start;
+- (void)stop;
+@end
NS_ASSUME_NONNULL_END

Powered by Google App Engine
This is Rietveld 408576698