| 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 "RTCVideoSource+Private.h" | 11 #import "RTCVideoSource+Private.h" |
| 12 | 12 |
| 13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
| 14 #include "webrtc/sdk/objc/Framework/Classes/objcvideotracksource.h" |
| 14 | 15 |
| 16 // TODO(magjed): Refactor this class and target ObjcVideoTrackSource only once |
| 17 // RTCAVFoundationVideoSource is gone. See http://crbug/webrtc/7177 for more |
| 18 // info. |
| 15 @implementation RTCVideoSource { | 19 @implementation RTCVideoSource { |
| 16 rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> _nativeVideoSource; | 20 rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> _nativeVideoSource; |
| 17 } | 21 } |
| 18 | 22 |
| 19 - (instancetype)initWithNativeVideoSource: | 23 - (instancetype)initWithNativeVideoSource: |
| 20 (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource { | 24 (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource { |
| 21 RTC_DCHECK(nativeVideoSource); | 25 RTC_DCHECK(nativeVideoSource); |
| 22 if (self = [super initWithNativeMediaSource:nativeVideoSource | 26 if (self = [super initWithNativeMediaSource:nativeVideoSource |
| 23 type:RTCMediaSourceTypeVideo]) { | 27 type:RTCMediaSourceTypeVideo]) { |
| 24 _nativeVideoSource = nativeVideoSource; | 28 _nativeVideoSource = nativeVideoSource; |
| 25 } | 29 } |
| 26 return self; | 30 return self; |
| 27 } | 31 } |
| 28 | 32 |
| 29 - (instancetype)initWithNativeMediaSource: | 33 - (instancetype)initWithNativeMediaSource: |
| 30 (rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource | 34 (rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource |
| 31 type:(RTCMediaSourceType)type { | 35 type:(RTCMediaSourceType)type { |
| 32 RTC_NOTREACHED(); | 36 RTC_NOTREACHED(); |
| 33 return nil; | 37 return nil; |
| 34 } | 38 } |
| 35 | 39 |
| 36 - (NSString *)description { | 40 - (NSString *)description { |
| 37 NSString *stateString = [[self class] stringForState:self.state]; | 41 NSString *stateString = [[self class] stringForState:self.state]; |
| 38 return [NSString stringWithFormat:@"RTCVideoSource( %p ): %@", self, stateStri
ng]; | 42 return [NSString stringWithFormat:@"RTCVideoSource( %p ): %@", self, stateStri
ng]; |
| 39 } | 43 } |
| 40 | 44 |
| 45 - (void)capturer:(RTCVideoCapturer *)capturer didCaptureVideoFrame:(RTCVideoFram
e *)frame { |
| 46 static_cast<webrtc::ObjcVideoTrackSource *>(_nativeVideoSource.get())->OnCaptu
redFrame(frame); |
| 47 } |
| 48 |
| 49 - (void)adaptOutputFormatToWidth:(int)width height:(int)height fps:(int)fps { |
| 50 static_cast<webrtc::ObjcVideoTrackSource *>(_nativeVideoSource.get()) |
| 51 ->OnOutputFormatRequest(width, height, fps); |
| 52 } |
| 53 |
| 41 #pragma mark - Private | 54 #pragma mark - Private |
| 42 | 55 |
| 43 - (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource { | 56 - (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource { |
| 44 return _nativeVideoSource; | 57 return _nativeVideoSource; |
| 45 } | 58 } |
| 46 | 59 |
| 47 @end | 60 @end |
| OLD | NEW |