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

Side by Side Diff: webrtc/api/objc/RTCAVFoundationVideoSource.mm

Issue 1559753002: Move RTCAVFoundationCapturer to webrtc/api/objc. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@updateRTCVideoSource
Patch Set: Update from feedback Created 4 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #import "RTCAVFoundationVideoSource+Private.h"
12
13 #import "webrtc/api/objc/RTCMediaConstraints+Private.h"
14 #import "webrtc/api/objc/RTCPeerConnectionFactory+Private.h"
15 #import "webrtc/api/objc/RTCVideoSource+Private.h"
16
17 @implementation RTCAVFoundationVideoSource
18
19 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
20 constraints:(RTCMediaConstraints *)constraints {
21 NSParameterAssert(factory);
22 rtc::scoped_ptr<webrtc::AVFoundationVideoCapturer> capturer;
23 capturer.reset(new webrtc::AVFoundationVideoCapturer());
24 rtc::scoped_refptr<webrtc::VideoSourceInterface> source =
25 factory.nativeFactory->CreateVideoSource(capturer.release(),
26 constraints.nativeConstraints.get());
27 return [super initWithNativeVideoSource:source];
28 }
29
30 - (BOOL)useBackCamera {
31 return self.capturer->GetUseBackCamera();
32 }
33
34 - (void)setUseBackCamera:(BOOL)useBackCamera {
35 self.capturer->SetUseBackCamera(useBackCamera);
36 }
37
38 - (AVCaptureSession *)captureSession {
39 return self.capturer->GetCaptureSession();
40 }
41
42 - (webrtc::AVFoundationVideoCapturer *)capturer {
43 cricket::VideoCapturer *capturer = self.nativeVideoSource->GetVideoCapturer();
44 // This should be safe because no one should have changed the underlying video
45 // source.
46 webrtc::AVFoundationVideoCapturer *foundationCapturer =
47 static_cast<webrtc::AVFoundationVideoCapturer *>(capturer);
48 return foundationCapturer;
49 }
50
51 @end
OLDNEW
« no previous file with comments | « webrtc/api/objc/RTCAVFoundationVideoSource.h ('k') | webrtc/api/objc/RTCAVFoundationVideoSource+Private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698