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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack | 57 (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack |
58 type:(RTCMediaStreamTrackType)type { | 58 type:(RTCMediaStreamTrackType)type { |
59 NSParameterAssert(nativeTrack); | 59 NSParameterAssert(nativeTrack); |
60 if (self = [super init]) { | 60 if (self = [super init]) { |
61 _nativeTrack = nativeTrack; | 61 _nativeTrack = nativeTrack; |
62 _type = type; | 62 _type = type; |
63 } | 63 } |
64 return self; | 64 return self; |
65 } | 65 } |
66 | 66 |
| 67 - (instancetype)initWithNativeTrack: |
| 68 (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack { |
| 69 NSParameterAssert(nativeTrack); |
| 70 if (nativeTrack->kind() == |
| 71 std::string(webrtc::MediaStreamTrackInterface::kAudioKind)) { |
| 72 return [self initWithNativeTrack:nativeTrack |
| 73 type:RTCMediaStreamTrackTypeAudio]; |
| 74 } |
| 75 if (nativeTrack->kind() == |
| 76 std::string(webrtc::MediaStreamTrackInterface::kVideoKind)) { |
| 77 return [self initWithNativeTrack:nativeTrack |
| 78 type:RTCMediaStreamTrackTypeVideo]; |
| 79 } |
| 80 return nil; |
| 81 } |
| 82 |
67 + (webrtc::MediaStreamTrackInterface::TrackState)nativeTrackStateForState: | 83 + (webrtc::MediaStreamTrackInterface::TrackState)nativeTrackStateForState: |
68 (RTCMediaStreamTrackState)state { | 84 (RTCMediaStreamTrackState)state { |
69 switch (state) { | 85 switch (state) { |
70 case RTCMediaStreamTrackStateLive: | 86 case RTCMediaStreamTrackStateLive: |
71 return webrtc::MediaStreamTrackInterface::kLive; | 87 return webrtc::MediaStreamTrackInterface::kLive; |
72 case RTCMediaStreamTrackStateEnded: | 88 case RTCMediaStreamTrackStateEnded: |
73 return webrtc::MediaStreamTrackInterface::kEnded; | 89 return webrtc::MediaStreamTrackInterface::kEnded; |
74 } | 90 } |
75 } | 91 } |
76 | 92 |
(...skipping 10 matching lines...) Expand all Loading... |
87 + (NSString *)stringForState:(RTCMediaStreamTrackState)state { | 103 + (NSString *)stringForState:(RTCMediaStreamTrackState)state { |
88 switch (state) { | 104 switch (state) { |
89 case RTCMediaStreamTrackStateLive: | 105 case RTCMediaStreamTrackStateLive: |
90 return @"Live"; | 106 return @"Live"; |
91 case RTCMediaStreamTrackStateEnded: | 107 case RTCMediaStreamTrackStateEnded: |
92 return @"Ended"; | 108 return @"Ended"; |
93 } | 109 } |
94 } | 110 } |
95 | 111 |
96 @end | 112 @end |
OLD | NEW |