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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCMediaSource.mm

Issue 2890733003: Reland of Split iOS sdk in to separate targets (Closed)
Patch Set: Created 3 years, 7 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
(Empty)
1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #import "RTCMediaSource+Private.h"
12
13 #include "webrtc/base/checks.h"
14
15 @implementation RTCMediaSource {
16 RTCMediaSourceType _type;
17 }
18
19 @synthesize nativeMediaSource = _nativeMediaSource;
20
21 - (instancetype)initWithNativeMediaSource:
22 (rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource
23 type:(RTCMediaSourceType)type {
24 RTC_DCHECK(nativeMediaSource);
25 if (self = [super init]) {
26 _nativeMediaSource = nativeMediaSource;
27 _type = type;
28 }
29 return self;
30 }
31
32 - (RTCSourceState)state {
33 return [[self class] sourceStateForNativeState:_nativeMediaSource->state()];
34 }
35
36 #pragma mark - Private
37
38 + (webrtc::MediaSourceInterface::SourceState)nativeSourceStateForState:
39 (RTCSourceState)state {
40 switch (state) {
41 case RTCSourceStateInitializing:
42 return webrtc::MediaSourceInterface::kInitializing;
43 case RTCSourceStateLive:
44 return webrtc::MediaSourceInterface::kLive;
45 case RTCSourceStateEnded:
46 return webrtc::MediaSourceInterface::kEnded;
47 case RTCSourceStateMuted:
48 return webrtc::MediaSourceInterface::kMuted;
49 }
50 }
51
52 + (RTCSourceState)sourceStateForNativeState:
53 (webrtc::MediaSourceInterface::SourceState)nativeState {
54 switch (nativeState) {
55 case webrtc::MediaSourceInterface::kInitializing:
56 return RTCSourceStateInitializing;
57 case webrtc::MediaSourceInterface::kLive:
58 return RTCSourceStateLive;
59 case webrtc::MediaSourceInterface::kEnded:
60 return RTCSourceStateEnded;
61 case webrtc::MediaSourceInterface::kMuted:
62 return RTCSourceStateMuted;
63 }
64 }
65
66 + (NSString *)stringForState:(RTCSourceState)state {
67 switch (state) {
68 case RTCSourceStateInitializing:
69 return @"Initializing";
70 case RTCSourceStateLive:
71 return @"Live";
72 case RTCSourceStateEnded:
73 return @"Ended";
74 case RTCSourceStateMuted:
75 return @"Muted";
76 }
77 }
78
79 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698