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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCAVFoundationVideoSource.mm

Issue 2685093002: Switching some interfaces to use std::unique_ptr<>. (Closed)
Patch Set: Rebase onto master Created 3 years, 10 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
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #import "RTCAVFoundationVideoSource+Private.h" 11 #import "RTCAVFoundationVideoSource+Private.h"
12 12
13 #import "RTCMediaConstraints+Private.h" 13 #import "RTCMediaConstraints+Private.h"
14 #import "RTCPeerConnectionFactory+Private.h" 14 #import "RTCPeerConnectionFactory+Private.h"
15 #import "RTCVideoSource+Private.h" 15 #import "RTCVideoSource+Private.h"
16 16
17 @implementation RTCAVFoundationVideoSource { 17 @implementation RTCAVFoundationVideoSource {
18 webrtc::AVFoundationVideoCapturer *_capturer; 18 webrtc::AVFoundationVideoCapturer *_capturer;
19 } 19 }
20 20
21 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory 21 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
22 constraints:(RTCMediaConstraints *)constraints { 22 constraints:(RTCMediaConstraints *)constraints {
23 NSParameterAssert(factory); 23 NSParameterAssert(factory);
24 // We pass ownership of the capturer to the source, but since we own 24 // We pass ownership of the capturer to the source, but since we own
25 // the source, it should be ok to keep a raw pointer to the 25 // the source, it should be ok to keep a raw pointer to the
26 // capturer. 26 // capturer.
27 _capturer = new webrtc::AVFoundationVideoCapturer(); 27 _capturer = new webrtc::AVFoundationVideoCapturer();
28 rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source = 28 rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source =
29 factory.nativeFactory->CreateVideoSource( 29 factory.nativeFactory->CreateVideoSource(
30 _capturer, constraints.nativeConstraints.get()); 30 std::unique_ptr<cricket::VideoCapturer>(_capturer),
31 constraints.nativeConstraints.get());
31 32
32 return [super initWithNativeVideoSource:source]; 33 return [super initWithNativeVideoSource:source];
33 } 34 }
34 35
35 - (void)adaptOutputFormatToWidth:(int)width 36 - (void)adaptOutputFormatToWidth:(int)width
36 height:(int)height 37 height:(int)height
37 fps:(int)fps { 38 fps:(int)fps {
38 self.capturer->AdaptOutputFormat(width, height, fps); 39 self.capturer->AdaptOutputFormat(width, height, fps);
39 } 40 }
40 41
(...skipping 11 matching lines...) Expand all
52 53
53 - (AVCaptureSession *)captureSession { 54 - (AVCaptureSession *)captureSession {
54 return self.capturer->GetCaptureSession(); 55 return self.capturer->GetCaptureSession();
55 } 56 }
56 57
57 - (webrtc::AVFoundationVideoCapturer *)capturer { 58 - (webrtc::AVFoundationVideoCapturer *)capturer {
58 return _capturer; 59 return _capturer;
59 } 60 }
60 61
61 @end 62 @end
OLDNEW
« webrtc/pc/videocapturertracksource.h ('K') | « webrtc/pc/webrtcsession_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698