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

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

Issue 1546783002: Move RTCVideoSource to webrtc/api/objc. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@updateRTCMediaSource
Patch Set: Changes based on feedback Created 4 years, 11 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
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698