Anders Carlsson | 7311918 | 2018-03-15 09:41:03 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 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 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 11 | #include "sdk/objc/native/api/video_capturer.h" |
Anders Carlsson | 7311918 | 2018-03-15 09:41:03 +0100 | [diff] [blame] | 12 | |
Karl Wiberg | 918f50c | 2018-07-05 11:40:33 +0200 | [diff] [blame] | 13 | #include "absl/memory/memory.h" |
Anders Carlsson | 7311918 | 2018-03-15 09:41:03 +0100 | [diff] [blame] | 14 | #include "api/videosourceproxy.h" |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 15 | #include "sdk/objc/native/src/objc_video_track_source.h" |
Anders Carlsson | 7311918 | 2018-03-15 09:41:03 +0100 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | |
| 19 | rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> ObjCToNativeVideoCapturer( |
| 20 | RTCVideoCapturer *objc_video_capturer, |
| 21 | rtc::Thread *signaling_thread, |
| 22 | rtc::Thread *worker_thread) { |
| 23 | RTCObjCVideoSourceAdapter *adapter = [[RTCObjCVideoSourceAdapter alloc] init]; |
| 24 | rtc::scoped_refptr<webrtc::ObjCVideoTrackSource> objc_video_track_source( |
| 25 | new rtc::RefCountedObject<webrtc::ObjCVideoTrackSource>(adapter)); |
| 26 | rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> video_source = |
| 27 | webrtc::VideoTrackSourceProxy::Create( |
| 28 | signaling_thread, worker_thread, objc_video_track_source); |
| 29 | |
| 30 | objc_video_capturer.delegate = adapter; |
| 31 | |
| 32 | return video_source; |
| 33 | } |
| 34 | |
| 35 | } // namespace webrtc |