blob: 3bad9985a1acb725238117e8fe2d6d4b65ff2a32 [file] [log] [blame]
Anders Carlsson73119182018-03-15 09:41:03 +01001/*
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 Carlsson7bca8ca2018-08-30 09:30:29 +020011#include "sdk/objc/native/api/video_capturer.h"
Anders Carlsson73119182018-03-15 09:41:03 +010012
Karl Wiberg918f50c2018-07-05 11:40:33 +020013#include "absl/memory/memory.h"
Anders Carlsson73119182018-03-15 09:41:03 +010014#include "api/videosourceproxy.h"
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020015#include "sdk/objc/native/src/objc_video_track_source.h"
Anders Carlsson73119182018-03-15 09:41:03 +010016
17namespace webrtc {
18
19rtc::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