OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |