OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "webrtc/base/bind.h" | 33 #include "webrtc/base/bind.h" |
34 #include "webrtc/base/checks.h" | 34 #include "webrtc/base/checks.h" |
35 | 35 |
36 namespace webrtc_jni { | 36 namespace webrtc_jni { |
37 | 37 |
38 SurfaceTextureHelper::SurfaceTextureHelper(JNIEnv* jni, | 38 SurfaceTextureHelper::SurfaceTextureHelper(JNIEnv* jni, |
39 jobject egl_shared_context) | 39 jobject egl_shared_context) |
40 : j_surface_texture_helper_class_( | 40 : j_surface_texture_helper_class_( |
41 jni, | 41 jni, |
42 FindClass(jni, "org/webrtc/SurfaceTextureHelper")), | 42 FindClass(jni, "org/webrtc/SurfaceTextureHelper")), |
43 j_surface_texture_helper_(jni, jni->CallStaticObjectMethod( | 43 j_surface_texture_helper_( |
44 *j_surface_texture_helper_class_, | 44 jni, |
45 GetStaticMethodID( | 45 jni->CallStaticObjectMethod( |
46 jni, | |
47 *j_surface_texture_helper_class_, | 46 *j_surface_texture_helper_class_, |
48 "create", | 47 GetStaticMethodID(jni, |
49 "(Landroid/opengl/EGLContext;)Lorg/webrtc/SurfaceTextureHelper;"), | 48 *j_surface_texture_helper_class_, |
50 egl_shared_context)), | 49 "create", |
| 50 "(Ljavax/microedition/khronos/egl/EGLContext;)" |
| 51 "Lorg/webrtc/SurfaceTextureHelper;"), |
| 52 egl_shared_context)), |
51 j_return_texture_method_(GetMethodID(jni, | 53 j_return_texture_method_(GetMethodID(jni, |
52 *j_surface_texture_helper_class_, | 54 *j_surface_texture_helper_class_, |
53 "returnTextureFrame", | 55 "returnTextureFrame", |
54 "()V")) { | 56 "()V")) { |
55 CHECK_EXCEPTION(jni) << "error during initialization of SurfaceTextureHelper"; | 57 CHECK_EXCEPTION(jni) << "error during initialization of SurfaceTextureHelper"; |
56 } | 58 } |
57 | 59 |
58 SurfaceTextureHelper::~SurfaceTextureHelper() { | 60 SurfaceTextureHelper::~SurfaceTextureHelper() { |
59 } | 61 } |
60 | 62 |
61 void SurfaceTextureHelper::ReturnTextureFrame() const { | 63 void SurfaceTextureHelper::ReturnTextureFrame() const { |
62 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 64 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
63 jni->CallVoidMethod(*j_surface_texture_helper_, j_return_texture_method_); | 65 jni->CallVoidMethod(*j_surface_texture_helper_, j_return_texture_method_); |
64 | 66 |
65 CHECK_EXCEPTION( | 67 CHECK_EXCEPTION( |
66 jni) << "error during SurfaceTextureHelper.returnTextureFrame"; | 68 jni) << "error during SurfaceTextureHelper.returnTextureFrame"; |
67 } | 69 } |
68 | 70 |
69 rtc::scoped_refptr<webrtc::VideoFrameBuffer> | 71 rtc::scoped_refptr<webrtc::VideoFrameBuffer> |
70 SurfaceTextureHelper::CreateTextureFrame(int width, int height, | 72 SurfaceTextureHelper::CreateTextureFrame(int width, int height, |
71 const NativeTextureHandleImpl& native_handle) { | 73 const NativeTextureHandleImpl& native_handle) { |
72 return new rtc::RefCountedObject<AndroidTextureBuffer>( | 74 return new rtc::RefCountedObject<AndroidTextureBuffer>( |
73 width, height, native_handle, | 75 width, height, native_handle, |
74 rtc::Bind(&SurfaceTextureHelper::ReturnTextureFrame, this)); | 76 rtc::Bind(&SurfaceTextureHelper::ReturnTextureFrame, this)); |
75 } | 77 } |
76 | 78 |
77 } // namespace webrtc_jni | 79 } // namespace webrtc_jni |
OLD | NEW |