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/api/java/jni/surfacetexturehelper_jni.h" | 12 #include "webrtc/api/java/jni/surfacetexturehelper_jni.h" |
13 | 13 |
14 #include "webrtc/api/java/jni/classreferenceholder.h" | 14 #include "webrtc/api/java/jni/classreferenceholder.h" |
15 #include "webrtc/base/bind.h" | 15 #include "webrtc/base/bind.h" |
16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
17 | 17 |
18 namespace webrtc_jni { | 18 namespace webrtc_jni { |
19 | 19 |
20 SurfaceTextureHelper::SurfaceTextureHelper( | 20 SurfaceTextureHelper::SurfaceTextureHelper( |
21 JNIEnv* jni, jobject j_egl_context) | 21 JNIEnv* jni, const char* thread_name, jobject j_egl_context) |
22 : j_surface_texture_helper_(jni, jni->CallStaticObjectMethod( | 22 : j_surface_texture_helper_(jni, jni->CallStaticObjectMethod( |
23 FindClass(jni, "org/webrtc/SurfaceTextureHelper"), | 23 FindClass(jni, "org/webrtc/SurfaceTextureHelper"), |
24 GetStaticMethodID(jni, | 24 GetStaticMethodID(jni, |
25 FindClass(jni, "org/webrtc/SurfaceTextureHelper"), | 25 FindClass(jni, "org/webrtc/SurfaceTextureHelper"), |
26 "create", | 26 "create", |
27 "(Lorg/webrtc/EglBase$Context;)" | 27 "(Ljava/lang/String;Lorg/webrtc/EglBase$Context;)" |
28 "Lorg/webrtc/SurfaceTextureHelper;"), | 28 "Lorg/webrtc/SurfaceTextureHelper;"), |
29 j_egl_context)), | 29 jni->NewStringUTF(thread_name), j_egl_context)), |
30 j_return_texture_method_( | 30 j_return_texture_method_( |
31 GetMethodID(jni, | 31 GetMethodID(jni, |
32 FindClass(jni, "org/webrtc/SurfaceTextureHelper"), | 32 FindClass(jni, "org/webrtc/SurfaceTextureHelper"), |
33 "returnTextureFrame", | 33 "returnTextureFrame", |
34 "()V")) { | 34 "()V")) { |
35 CHECK_EXCEPTION(jni) << "error during initialization of SurfaceTextureHelper"; | 35 CHECK_EXCEPTION(jni) << "error during initialization of SurfaceTextureHelper"; |
36 } | 36 } |
37 | 37 |
38 SurfaceTextureHelper::~SurfaceTextureHelper() { | 38 SurfaceTextureHelper::~SurfaceTextureHelper() { |
39 } | 39 } |
(...skipping 12 matching lines...) Expand all Loading... |
52 | 52 |
53 rtc::scoped_refptr<webrtc::VideoFrameBuffer> | 53 rtc::scoped_refptr<webrtc::VideoFrameBuffer> |
54 SurfaceTextureHelper::CreateTextureFrame(int width, int height, | 54 SurfaceTextureHelper::CreateTextureFrame(int width, int height, |
55 const NativeHandleImpl& native_handle) { | 55 const NativeHandleImpl& native_handle) { |
56 return new rtc::RefCountedObject<AndroidTextureBuffer>( | 56 return new rtc::RefCountedObject<AndroidTextureBuffer>( |
57 width, height, native_handle, *j_surface_texture_helper_, | 57 width, height, native_handle, *j_surface_texture_helper_, |
58 rtc::Bind(&SurfaceTextureHelper::ReturnTextureFrame, this)); | 58 rtc::Bind(&SurfaceTextureHelper::ReturnTextureFrame, this)); |
59 } | 59 } |
60 | 60 |
61 } // namespace webrtc_jni | 61 } // namespace webrtc_jni |
OLD | NEW |