• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
11#include "sdk/objc/native/api/video_capturer.h"
12
13#include "absl/memory/memory.h"
14#include "api/video_track_source_proxy.h"
15#include "sdk/objc/native/src/objc_video_track_source.h"
16
17namespace webrtc {
18
19rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> ObjCToNativeVideoCapturer(
20    RTC_OBJC_TYPE(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
36