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 |
11 #import "RTCMediaStreamTrack.h" | 11 #import "RTCMediaStreamTrack.h" |
12 | 12 |
13 #import "webrtc/api/objc/RTCMediaStreamTrack+Private.h" | 13 #import "webrtc/api/objc/RTCMediaStreamTrack+Private.h" |
14 #import "webrtc/base/objc/NSString+StdString.h" | 14 #import "webrtc/base/objc/NSString+StdString.h" |
15 | 15 |
16 @implementation RTCMediaStreamTrack { | 16 @implementation RTCMediaStreamTrack { |
17 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> _nativeTrack; | 17 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> _nativeTrack; |
| 18 RTCMediaStreamTrackType _type; |
18 } | 19 } |
19 | 20 |
20 - (NSString *)kind { | 21 - (NSString *)kind { |
21 return [NSString stringForStdString:_nativeTrack->kind()]; | 22 return [NSString stringForStdString:_nativeTrack->kind()]; |
22 } | 23 } |
23 | 24 |
24 - (NSString *)trackId { | 25 - (NSString *)trackId { |
25 return [NSString stringForStdString:_nativeTrack->id()]; | 26 return [NSString stringForStdString:_nativeTrack->id()]; |
26 } | 27 } |
27 | 28 |
(...skipping 18 matching lines...) Expand all Loading... |
46 readyState]; | 47 readyState]; |
47 } | 48 } |
48 | 49 |
49 #pragma mark - Private | 50 #pragma mark - Private |
50 | 51 |
51 - (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack { | 52 - (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack { |
52 return _nativeTrack; | 53 return _nativeTrack; |
53 } | 54 } |
54 | 55 |
55 - (instancetype)initWithNativeTrack: | 56 - (instancetype)initWithNativeTrack: |
56 (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack { | 57 (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack |
| 58 type:(RTCMediaStreamTrackType)type { |
57 NSParameterAssert(nativeTrack); | 59 NSParameterAssert(nativeTrack); |
58 if (self = [super init]) { | 60 if (self = [super init]) { |
59 _nativeTrack = nativeTrack; | 61 _nativeTrack = nativeTrack; |
| 62 _type = type; |
60 } | 63 } |
61 return self; | 64 return self; |
62 } | 65 } |
63 | 66 |
64 + (webrtc::MediaStreamTrackInterface::TrackState)nativeTrackStateForState: | 67 + (webrtc::MediaStreamTrackInterface::TrackState)nativeTrackStateForState: |
65 (RTCMediaStreamTrackState)state { | 68 (RTCMediaStreamTrackState)state { |
66 switch (state) { | 69 switch (state) { |
67 case RTCMediaStreamTrackStateInitializing: | 70 case RTCMediaStreamTrackStateInitializing: |
68 return webrtc::MediaStreamTrackInterface::kInitializing; | 71 return webrtc::MediaStreamTrackInterface::kInitializing; |
69 case RTCMediaStreamTrackStateLive: | 72 case RTCMediaStreamTrackStateLive: |
(...skipping 26 matching lines...) Expand all Loading... |
96 case RTCMediaStreamTrackStateLive: | 99 case RTCMediaStreamTrackStateLive: |
97 return @"Live"; | 100 return @"Live"; |
98 case RTCMediaStreamTrackStateEnded: | 101 case RTCMediaStreamTrackStateEnded: |
99 return @"Ended"; | 102 return @"Ended"; |
100 case RTCMediaStreamTrackStateFailed: | 103 case RTCMediaStreamTrackStateFailed: |
101 return @"Failed"; | 104 return @"Failed"; |
102 } | 105 } |
103 } | 106 } |
104 | 107 |
105 @end | 108 @end |
OLD | NEW |