| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 | 11 |
| 12 #include "webrtc/sdk/android/src/jni/surfacetexturehelper_jni.h" | 12 #include "webrtc/sdk/android/src/jni/surfacetexturehelper_jni.h" |
| 13 | 13 |
| 14 #include "webrtc/rtc_base/bind.h" | 14 #include "webrtc/rtc_base/bind.h" |
| 15 #include "webrtc/rtc_base/checks.h" | 15 #include "webrtc/rtc_base/checks.h" |
| 16 #include "webrtc/rtc_base/logging.h" | 16 #include "webrtc/rtc_base/logging.h" |
| 17 #include "webrtc/sdk/android/src/jni/classreferenceholder.h" | 17 #include "webrtc/sdk/android/src/jni/classreferenceholder.h" |
| 18 | 18 |
| 19 namespace webrtc_jni { | 19 namespace webrtc { |
| 20 namespace jni { |
| 20 | 21 |
| 21 rtc::scoped_refptr<SurfaceTextureHelper> SurfaceTextureHelper::create( | 22 rtc::scoped_refptr<SurfaceTextureHelper> SurfaceTextureHelper::create( |
| 22 JNIEnv* jni, | 23 JNIEnv* jni, |
| 23 const char* thread_name, | 24 const char* thread_name, |
| 24 jobject j_egl_context) { | 25 jobject j_egl_context) { |
| 25 jobject j_surface_texture_helper = jni->CallStaticObjectMethod( | 26 jobject j_surface_texture_helper = jni->CallStaticObjectMethod( |
| 26 FindClass(jni, "org/webrtc/SurfaceTextureHelper"), | 27 FindClass(jni, "org/webrtc/SurfaceTextureHelper"), |
| 27 GetStaticMethodID(jni, FindClass(jni, "org/webrtc/SurfaceTextureHelper"), | 28 GetStaticMethodID(jni, FindClass(jni, "org/webrtc/SurfaceTextureHelper"), |
| 28 "create", | 29 "create", |
| 29 "(Ljava/lang/String;Lorg/webrtc/EglBase$Context;)" | 30 "(Ljava/lang/String;Lorg/webrtc/EglBase$Context;)" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 65 } |
| 65 | 66 |
| 66 void SurfaceTextureHelper::ReturnTextureFrame() const { | 67 void SurfaceTextureHelper::ReturnTextureFrame() const { |
| 67 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 68 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
| 68 jni->CallVoidMethod(*j_surface_texture_helper_, j_return_texture_method_); | 69 jni->CallVoidMethod(*j_surface_texture_helper_, j_return_texture_method_); |
| 69 | 70 |
| 70 CHECK_EXCEPTION( | 71 CHECK_EXCEPTION( |
| 71 jni) << "error during SurfaceTextureHelper.returnTextureFrame"; | 72 jni) << "error during SurfaceTextureHelper.returnTextureFrame"; |
| 72 } | 73 } |
| 73 | 74 |
| 74 rtc::scoped_refptr<webrtc::VideoFrameBuffer> | 75 rtc::scoped_refptr<VideoFrameBuffer> SurfaceTextureHelper::CreateTextureFrame( |
| 75 SurfaceTextureHelper::CreateTextureFrame(int width, int height, | 76 int width, |
| 77 int height, |
| 76 const NativeHandleImpl& native_handle) { | 78 const NativeHandleImpl& native_handle) { |
| 77 return new rtc::RefCountedObject<AndroidTextureBuffer>( | 79 return new rtc::RefCountedObject<AndroidTextureBuffer>( |
| 78 width, height, native_handle, *j_surface_texture_helper_, | 80 width, height, native_handle, *j_surface_texture_helper_, |
| 79 rtc::Bind(&SurfaceTextureHelper::ReturnTextureFrame, this)); | 81 rtc::Bind(&SurfaceTextureHelper::ReturnTextureFrame, this)); |
| 80 } | 82 } |
| 81 | 83 |
| 82 } // namespace webrtc_jni | 84 } // namespace jni |
| 85 } // namespace webrtc |
| OLD | NEW |