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

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

Issue 1696673003: Tweaks for new Objective-C API. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: More tweaks based on updating AppRTCDemo Created 4 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
« no previous file with comments | « webrtc/api/objc/RTCVideoRenderer.h ('k') | webrtc/api/objctests/RTCSessionDescriptionTest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 15 matching lines...) Expand all
26 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory 26 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
27 source:(RTCVideoSource *)source 27 source:(RTCVideoSource *)source
28 trackId:(NSString *)trackId { 28 trackId:(NSString *)trackId {
29 NSParameterAssert(factory); 29 NSParameterAssert(factory);
30 NSParameterAssert(source); 30 NSParameterAssert(source);
31 NSParameterAssert(trackId.length); 31 NSParameterAssert(trackId.length);
32 std::string nativeId = [NSString stdStringForString:trackId]; 32 std::string nativeId = [NSString stdStringForString:trackId];
33 rtc::scoped_refptr<webrtc::VideoTrackInterface> track = 33 rtc::scoped_refptr<webrtc::VideoTrackInterface> track =
34 factory.nativeFactory->CreateVideoTrack(nativeId, 34 factory.nativeFactory->CreateVideoTrack(nativeId,
35 source.nativeVideoSource); 35 source.nativeVideoSource);
36 return [self initWithNativeTrack:track type:RTCMediaStreamTrackTypeVideo]; 36 self = [super initWithNativeTrack:track type:RTCMediaStreamTrackTypeVideo];
hjon_webrtc 2016/02/19 20:55:34 If |source| was actually an RTCAVFoundationVideoSo
tkchin_webrtc 2016/02/19 23:26:38 you don't need to re-init the adapters, that shoul
hjon_webrtc 2016/02/19 23:58:36 Done.
37 if (self) {
38 _adapters = [NSMutableArray array];
39 _source = source;
40 }
41 return self;
37 } 42 }
38 43
39 - (instancetype)initWithNativeMediaTrack: 44 - (instancetype)initWithNativeTrack:
40 (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeMediaTrack 45 (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeMediaTrack
41 type:(RTCMediaStreamTrackType)type { 46 type:(RTCMediaStreamTrackType)type {
42 NSParameterAssert(nativeMediaTrack); 47 NSParameterAssert(nativeMediaTrack);
43 NSParameterAssert(type == RTCMediaStreamTrackTypeVideo); 48 NSParameterAssert(type == RTCMediaStreamTrackTypeVideo);
44 if (self = [super initWithNativeTrack:nativeMediaTrack type:type]) { 49 if (self = [super initWithNativeTrack:nativeMediaTrack type:type]) {
45 _adapters = [NSMutableArray array]; 50 _adapters = [NSMutableArray array];
46 rtc::scoped_refptr<webrtc::VideoSourceInterface> source = 51 rtc::scoped_refptr<webrtc::VideoSourceInterface> source =
47 self.nativeVideoTrack->GetSource(); 52 self.nativeVideoTrack->GetSource();
48 if (source) { 53 if (source) {
49 _source = [[RTCVideoSource alloc] initWithNativeVideoSource:source.get()]; 54 _source = [[RTCVideoSource alloc] initWithNativeVideoSource:source.get()];
50 } 55 }
51 } 56 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 [_adapters removeObjectAtIndex:indexToRemove]; 96 [_adapters removeObjectAtIndex:indexToRemove];
92 } 97 }
93 98
94 #pragma mark - Private 99 #pragma mark - Private
95 100
96 - (rtc::scoped_refptr<webrtc::VideoTrackInterface>)nativeVideoTrack { 101 - (rtc::scoped_refptr<webrtc::VideoTrackInterface>)nativeVideoTrack {
97 return static_cast<webrtc::VideoTrackInterface *>(self.nativeTrack.get()); 102 return static_cast<webrtc::VideoTrackInterface *>(self.nativeTrack.get());
98 } 103 }
99 104
100 @end 105 @end
OLDNEW
« no previous file with comments | « webrtc/api/objc/RTCVideoRenderer.h ('k') | webrtc/api/objctests/RTCSessionDescriptionTest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698