| Index: webrtc/sdk/objc/Framework/Classes/RTCVideoSource.mm
|
| diff --git a/webrtc/sdk/objc/Framework/Classes/RTCVideoSource.mm b/webrtc/sdk/objc/Framework/Classes/RTCVideoSource.mm
|
| index eddf5e0c684d7ad51a0d0360053d700fc0942b00..83a8b79ebe72339a6fc89b8cdf4a0188d81c8779 100644
|
| --- a/webrtc/sdk/objc/Framework/Classes/RTCVideoSource.mm
|
| +++ b/webrtc/sdk/objc/Framework/Classes/RTCVideoSource.mm
|
| @@ -10,73 +10,38 @@
|
|
|
| #import "RTCVideoSource+Private.h"
|
|
|
| +#include "webrtc/base/checks.h"
|
| +
|
| @implementation RTCVideoSource {
|
| rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> _nativeVideoSource;
|
| }
|
|
|
| -- (RTCSourceState)state {
|
| - return [[self class] sourceStateForNativeState:_nativeVideoSource->state()];
|
| -}
|
| -
|
| -- (NSString *)description {
|
| - return [NSString stringWithFormat:@"RTCVideoSource:\n%@",
|
| - [[self class] stringForState:self.state]];
|
| -}
|
| -
|
| -#pragma mark - Private
|
| -
|
| -- (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource {
|
| - return _nativeVideoSource;
|
| -}
|
| -
|
| - (instancetype)initWithNativeVideoSource:
|
| (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource {
|
| - NSParameterAssert(nativeVideoSource);
|
| - if (self = [super init]) {
|
| + RTC_DCHECK(nativeVideoSource);
|
| + if (self = [super initWithNativeMediaSource:nativeVideoSource
|
| + type:RTCMediaSourceTypeVideo]) {
|
| _nativeVideoSource = nativeVideoSource;
|
| }
|
| return self;
|
| }
|
|
|
| -+ (webrtc::MediaSourceInterface::SourceState)nativeSourceStateForState:
|
| - (RTCSourceState)state {
|
| - switch (state) {
|
| - case RTCSourceStateInitializing:
|
| - return webrtc::MediaSourceInterface::kInitializing;
|
| - case RTCSourceStateLive:
|
| - return webrtc::MediaSourceInterface::kLive;
|
| - case RTCSourceStateEnded:
|
| - return webrtc::MediaSourceInterface::kEnded;
|
| - case RTCSourceStateMuted:
|
| - return webrtc::MediaSourceInterface::kMuted;
|
| - }
|
| +- (instancetype)initWithNativeMediaSource:
|
| + (rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource
|
| + type:(RTCMediaSourceType)type {
|
| + RTC_NOTREACHED();
|
| + return nil;
|
| }
|
|
|
| -+ (RTCSourceState)sourceStateForNativeState:
|
| - (webrtc::MediaSourceInterface::SourceState)nativeState {
|
| - switch (nativeState) {
|
| - case webrtc::MediaSourceInterface::kInitializing:
|
| - return RTCSourceStateInitializing;
|
| - case webrtc::MediaSourceInterface::kLive:
|
| - return RTCSourceStateLive;
|
| - case webrtc::MediaSourceInterface::kEnded:
|
| - return RTCSourceStateEnded;
|
| - case webrtc::MediaSourceInterface::kMuted:
|
| - return RTCSourceStateMuted;
|
| - }
|
| +- (NSString *)description {
|
| + NSString *stateString = [[self class] stringForState:self.state];
|
| + return [NSString stringWithFormat:@"RTCVideoSource( %p ): %@", self, stateString];
|
| }
|
|
|
| -+ (NSString *)stringForState:(RTCSourceState)state {
|
| - switch (state) {
|
| - case RTCSourceStateInitializing:
|
| - return @"Initializing";
|
| - case RTCSourceStateLive:
|
| - return @"Live";
|
| - case RTCSourceStateEnded:
|
| - return @"Ended";
|
| - case RTCSourceStateMuted:
|
| - return @"Muted";
|
| - }
|
| +#pragma mark - Private
|
| +
|
| +- (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource {
|
| + return _nativeVideoSource;
|
| }
|
|
|
| @end
|
|
|