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

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

Issue 2290583003: iOS: Add ability to specify audio constraints. (Closed)
Patch Set: Update ctor order. Created 4 years, 3 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 "RTCVideoSource+Private.h" 11 #import "RTCVideoSource+Private.h"
12 12
13 #include "webrtc/base/checks.h"
14
13 @implementation RTCVideoSource { 15 @implementation RTCVideoSource {
14 rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> _nativeVideoSource; 16 rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> _nativeVideoSource;
15 } 17 }
16 18
17 - (RTCSourceState)state { 19 - (instancetype)initWithNativeVideoSource:
18 return [[self class] sourceStateForNativeState:_nativeVideoSource->state()]; 20 (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource {
21 RTC_DCHECK(nativeVideoSource);
22 if (self = [super initWithNativeMediaSource:nativeVideoSource
23 type:RTCMediaSourceTypeVideo]) {
24 _nativeVideoSource = nativeVideoSource;
25 }
26 return self;
27 }
28
29 - (instancetype)initWithNativeMediaSource:
30 (rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource
31 type:(RTCMediaSourceType)type {
32 RTC_NOTREACHED();
33 return nil;
19 } 34 }
20 35
21 - (NSString *)description { 36 - (NSString *)description {
22 return [NSString stringWithFormat:@"RTCVideoSource:\n%@", 37 NSString *stateString = [[self class] stringForState:self.state];
23 [[self class] stringForState:self.state]]; 38 return [NSString stringWithFormat:@"RTCVideoSource( %p ): %@", self, stateStri ng];
24 } 39 }
25 40
26 #pragma mark - Private 41 #pragma mark - Private
27 42
28 - (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource { 43 - (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource {
29 return _nativeVideoSource; 44 return _nativeVideoSource;
30 } 45 }
31 46
32 - (instancetype)initWithNativeVideoSource:
33 (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource {
34 NSParameterAssert(nativeVideoSource);
35 if (self = [super init]) {
36 _nativeVideoSource = nativeVideoSource;
37 }
38 return self;
39 }
40
41 + (webrtc::MediaSourceInterface::SourceState)nativeSourceStateForState:
42 (RTCSourceState)state {
43 switch (state) {
44 case RTCSourceStateInitializing:
45 return webrtc::MediaSourceInterface::kInitializing;
46 case RTCSourceStateLive:
47 return webrtc::MediaSourceInterface::kLive;
48 case RTCSourceStateEnded:
49 return webrtc::MediaSourceInterface::kEnded;
50 case RTCSourceStateMuted:
51 return webrtc::MediaSourceInterface::kMuted;
52 }
53 }
54
55 + (RTCSourceState)sourceStateForNativeState:
56 (webrtc::MediaSourceInterface::SourceState)nativeState {
57 switch (nativeState) {
58 case webrtc::MediaSourceInterface::kInitializing:
59 return RTCSourceStateInitializing;
60 case webrtc::MediaSourceInterface::kLive:
61 return RTCSourceStateLive;
62 case webrtc::MediaSourceInterface::kEnded:
63 return RTCSourceStateEnded;
64 case webrtc::MediaSourceInterface::kMuted:
65 return RTCSourceStateMuted;
66 }
67 }
68
69 + (NSString *)stringForState:(RTCSourceState)state {
70 switch (state) {
71 case RTCSourceStateInitializing:
72 return @"Initializing";
73 case RTCSourceStateLive:
74 return @"Live";
75 case RTCSourceStateEnded:
76 return @"Ended";
77 case RTCSourceStateMuted:
78 return @"Muted";
79 }
80 }
81
82 @end 47 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698