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 #ifndef SDK_ANDROID_NATIVE_API_VIDEO_WRAPPER_H_ 12 #define SDK_ANDROID_NATIVE_API_VIDEO_WRAPPER_H_ 13 14 #include <jni.h> 15 #include <memory> 16 17 #include "api/media_stream_interface.h" 18 #include "api/video/video_frame.h" 19 #include "sdk/android/native_api/jni/scoped_java_ref.h" 20 21 namespace webrtc { 22 23 // Creates an instance of rtc::VideoSinkInterface<VideoFrame> from Java 24 // VideoSink. 25 std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> JavaToNativeVideoSink( 26 JNIEnv* jni, 27 jobject video_sink); 28 29 // Creates a Java VideoFrame object from a native VideoFrame. The returned 30 // object has to be released by calling release. 31 ScopedJavaLocalRef<jobject> NativeToJavaVideoFrame(JNIEnv* jni, 32 const VideoFrame& frame); 33 34 } // namespace webrtc 35 36 #endif // SDK_ANDROID_NATIVE_API_VIDEO_WRAPPER_H_ 37