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

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: 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/RTCMediaSource+Private.h"
15 #import "webrtc/api/objc/RTCPeerConnectionFactory+Private.h"
16 #import "webrtc/api/objc/RTCVideoSource+Private.h"
17
18 @implementation RTCAVFoundationVideoSource
19
20 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
21 constraints:(RTCMediaConstraints *)constraints {
22 NSParameterAssert(factory);
23 rtc::scoped_ptr<webrtc::AVFoundationVideoCapturer> capturer;
24 capturer.reset(new webrtc::AVFoundationVideoCapturer());
25 rtc::scoped_refptr<webrtc::VideoSourceInterface> source =
26 factory.nativeFactory->CreateVideoSource(capturer.release(),
27 constraints.nativeConstraints);
28 return [super initWithMediaSource:source];
29 }
30
31 - (BOOL)useBackCamera {
32 return self.capturer->GetUseBackCamera();
33 }
34
35 - (void)setUseBackCamera:(BOOL)useBackCamera {
36 self.capturer->SetUseBackCamera(useBackCamera);
37 }
38
39 - (AVCaptureSession *)captureSession {
40 return self.capturer->GetCaptureSession();
41 }
42
43 - (webrtc::AVFoundationVideoCapturer *)capturer {
44 cricket::VideoCapturer *capturer = self.nativeVideoSource->GetVideoCapturer();
45 // This should be safe because no one should have changed the underlying video
46 // source.
47 webrtc::AVFoundationVideoCapturer *foundationCapturer =
48 static_cast<webrtc::AVFoundationVideoCapturer*>(capturer);
tkchin_webrtc 2016/01/14 01:45:46 update *
hjon 2016/01/14 19:54:12 Done.
49 return foundationCapturer;
50 }
51
52 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698