Chromium Code Reviews| 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 "RTCMediaSource.h" | 11 #import "RTCMediaSource.h" |
| 12 | 12 |
| 13 #import "webrtc/api/objc/RTCMediaSource+Private.h" | 13 #import "webrtc/api/objc/RTCMediaSource+Private.h" |
| 14 | 14 |
| 15 @implementation RTCMediaSource { | 15 @implementation RTCMediaSource |
| 16 rtc::scoped_refptr<webrtc::MediaSourceInterface> _nativeMediaSource; | |
| 17 } | |
| 18 | 16 |
| 19 - (RTCSourceState)state { | 17 - (RTCSourceState)state { |
| 20 return [[self class] sourceStateForNativeState:_nativeMediaSource->state()]; | 18 return [[self class] sourceStateForNativeState: |
| 19 self.nativeMediaSource->state()]; | |
| 21 } | 20 } |
| 22 | 21 |
| 23 - (NSString *)description { | 22 - (NSString *)description { |
| 24 return [NSString stringWithFormat:@"RTCMediaSource:\n%@", | 23 return [NSString stringWithFormat:@"RTCMediaSource:\n%@", |
| 25 [[self class] stringForState:self.state]]; | 24 [[self class] stringForState:self.state]]; |
| 26 } | 25 } |
| 27 | 26 |
| 28 #pragma mark - Private | 27 #pragma mark - Private |
| 29 | 28 |
| 30 - (rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource { | 29 - (rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource { |
| 31 return _nativeMediaSource; | 30 [self doesNotRecognizeSelector:_cmd]; |
| 31 return nullptr; | |
| 32 } | 32 } |
| 33 | 33 |
| 34 - (instancetype)initWithNativeMediaSource: | 34 - (rtc::scoped_refptr<webrtc::VideoSourceInterface>)nativeVideoSource { |
|
tkchin_webrtc
2016/01/13 02:26:27
You know what, I think the safest thing to do is t
hjon
2016/01/13 18:07:00
If we keep this ctor as a designated initializer a
tkchin_webrtc
2016/01/14 01:34:02
The RTCVideoSource ctor will call [super initWithN
hjon
2016/01/14 17:04:24
Let me think through this "out loud" to work throu
tkchin_webrtc
2016/01/14 22:27:41
Aha I gotcha. Sorry, I didn't think it through. Al
hjon
2016/01/14 23:18:10
It was a good exercise to think through it again a
| |
| 35 (rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource { | 35 [self doesNotRecognizeSelector:_cmd]; |
| 36 NSParameterAssert(nativeMediaSource); | 36 return nullptr; |
| 37 if (self = [super init]) { | |
| 38 _nativeMediaSource = nativeMediaSource; | |
| 39 } | |
| 40 return self; | |
| 41 } | 37 } |
| 42 | 38 |
| 43 + (webrtc::MediaSourceInterface::SourceState)nativeSourceStateForState: | 39 + (webrtc::MediaSourceInterface::SourceState)nativeSourceStateForState: |
| 44 (RTCSourceState)state { | 40 (RTCSourceState)state { |
| 45 switch (state) { | 41 switch (state) { |
| 46 case RTCSourceStateInitializing: | 42 case RTCSourceStateInitializing: |
| 47 return webrtc::MediaSourceInterface::kInitializing; | 43 return webrtc::MediaSourceInterface::kInitializing; |
| 48 case RTCSourceStateLive: | 44 case RTCSourceStateLive: |
| 49 return webrtc::MediaSourceInterface::kLive; | 45 return webrtc::MediaSourceInterface::kLive; |
| 50 case RTCSourceStateEnded: | 46 case RTCSourceStateEnded: |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 75 case RTCSourceStateLive: | 71 case RTCSourceStateLive: |
| 76 return @"Live"; | 72 return @"Live"; |
| 77 case RTCSourceStateEnded: | 73 case RTCSourceStateEnded: |
| 78 return @"Ended"; | 74 return @"Ended"; |
| 79 case RTCSourceStateMuted: | 75 case RTCSourceStateMuted: |
| 80 return @"Muted"; | 76 return @"Muted"; |
| 81 } | 77 } |
| 82 } | 78 } |
| 83 | 79 |
| 84 @end | 80 @end |
| OLD | NEW |