• 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/android/src/jni/video_sink.h"
12 
13 #include "sdk/android/generated_video_jni/VideoSink_jni.h"
14 #include "sdk/android/src/jni/video_frame.h"
15 
16 namespace webrtc {
17 namespace jni {
18 
VideoSinkWrapper(JNIEnv * jni,const JavaRef<jobject> & j_sink)19 VideoSinkWrapper::VideoSinkWrapper(JNIEnv* jni, const JavaRef<jobject>& j_sink)
20     : j_sink_(jni, j_sink) {}
21 
~VideoSinkWrapper()22 VideoSinkWrapper::~VideoSinkWrapper() {}
23 
OnFrame(const VideoFrame & frame)24 void VideoSinkWrapper::OnFrame(const VideoFrame& frame) {
25   JNIEnv* jni = AttachCurrentThreadIfNeeded();
26   ScopedJavaLocalRef<jobject> j_frame = NativeToJavaVideoFrame(jni, frame);
27   Java_VideoSink_onFrame(jni, j_sink_, j_frame);
28   ReleaseJavaVideoFrame(jni, j_frame);
29 }
30 
31 }  // namespace jni
32 }  // namespace webrtc
33