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 |