OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2017 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 <jni.h> |
| 12 |
| 13 #include "webrtc/media/engine/webrtcvideodecoderfactory.h" |
| 14 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" |
| 15 #include "webrtc/sdk/android/src/jni/androidmediadecoder_jni.h" |
| 16 #include "webrtc/sdk/android/src/jni/androidmediaencoder_jni.h" |
| 17 #include "webrtc/sdk/android/src/jni/androidvideotracksource.h" |
| 18 #include "webrtc/sdk/android/src/jni/surfacetexturehelper_jni.h" |
| 19 |
| 20 using cricket::WebRtcVideoDecoderFactory; |
| 21 using cricket::WebRtcVideoEncoderFactory; |
| 22 using webrtc::AndroidVideoTrackSource; |
| 23 |
| 24 namespace webrtc_jni { |
| 25 |
| 26 WebRtcVideoEncoderFactory* CreateVideoEncoderFactory() { |
| 27 return new MediaCodecVideoEncoderFactory(); |
| 28 } |
| 29 |
| 30 WebRtcVideoDecoderFactory* CreateVideoDecoderFactory() { |
| 31 return new MediaCodecVideoDecoderFactory(); |
| 32 } |
| 33 |
| 34 rtc::scoped_refptr<webrtc::AndroidVideoTrackSource> |
| 35 CreateAndroidVideoTrackSource(rtc::Thread* signaling_thread, |
| 36 JNIEnv* jni, |
| 37 jobject j_egl_context, |
| 38 bool is_screencast = false) { |
| 39 return rtc::scoped_refptr<webrtc::AndroidVideoTrackSource>( |
| 40 new rtc::RefCountedObject<webrtc::AndroidVideoTrackSource>( |
| 41 signaling_thread, jni, j_egl_context, is_screencast)); |
| 42 } |
| 43 |
| 44 jobject GetJavaSurfaceTextureHelper( |
| 45 rtc::scoped_refptr<SurfaceTextureHelper> surface_texture_helper) { |
| 46 return surface_texture_helper |
| 47 ? surface_texture_helper->GetJavaSurfaceTextureHelper() |
| 48 : nullptr; |
| 49 } |
| 50 |
| 51 void EncoderFactorySetEGLContext(MediaCodecVideoEncoderFactory* encoder_factory, |
| 52 JNIEnv* jni, |
| 53 jobject local_egl_context) { |
| 54 encoder_factory->SetEGLContext(jni, local_egl_context); |
| 55 } |
| 56 |
| 57 void DecoderFactorySetEGLContext(MediaCodecVideoDecoderFactory* decoder_factory, |
| 58 JNIEnv* jni, |
| 59 jobject remote_egl_context) { |
| 60 decoder_factory->SetEGLContext(jni, remote_egl_context); |
| 61 } |
| 62 |
| 63 } // namespace webrtc_jni |
OLD | NEW |