blob: 7b87ad6577166bde723bb62c35320beb96e9659d [file] [log] [blame]
Jonathan Yufa6a2832018-02-12 17:32:37 -08001/*
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/android/native_api/video/wrapper.h"
12
Karl Wiberg918f50c2018-07-05 11:40:33 +020013#include "absl/memory/memory.h"
Jonathan Yufa6a2832018-02-12 17:32:37 -080014#include "sdk/android/native_api/jni/scoped_java_ref.h"
Steve Anton10542f22019-01-11 09:11:00 -080015#include "sdk/android/src/jni/video_frame.h"
16#include "sdk/android/src/jni/video_sink.h"
Jonathan Yufa6a2832018-02-12 17:32:37 -080017
18namespace webrtc {
19
20std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> JavaToNativeVideoSink(
21 JNIEnv* jni,
22 jobject video_sink) {
Karl Wiberg918f50c2018-07-05 11:40:33 +020023 return absl::make_unique<jni::VideoSinkWrapper>(
Jonathan Yufa6a2832018-02-12 17:32:37 -080024 jni, JavaParamRef<jobject>(video_sink));
25}
26
27ScopedJavaLocalRef<jobject> NativeToJavaVideoFrame(JNIEnv* jni,
28 const VideoFrame& frame) {
Sami Kalliomäki2bde8502018-02-15 13:58:15 +010029 return jni::NativeToJavaVideoFrame(jni, frame);
Jonathan Yufa6a2832018-02-12 17:32:37 -080030}
31
32} // namespace webrtc