| 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 29 matching lines...) Expand all Loading... |
| 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_( | 43 j_surface_texture_helper_( |
| 44 jni, | 44 jni, |
| 45 jni->CallStaticObjectMethod( | 45 jni->CallStaticObjectMethod( |
| 46 *j_surface_texture_helper_class_, | 46 *j_surface_texture_helper_class_, |
| 47 GetStaticMethodID(jni, | 47 GetStaticMethodID(jni, |
| 48 *j_surface_texture_helper_class_, | 48 *j_surface_texture_helper_class_, |
| 49 "create", | 49 "create", |
| 50 "(Ljavax/microedition/khronos/egl/EGLContext;)" | 50 "(Lorg/webrtc/EglBase$Context;)" |
| 51 "Lorg/webrtc/SurfaceTextureHelper;"), | 51 "Lorg/webrtc/SurfaceTextureHelper;"), |
| 52 egl_shared_context)), | 52 egl_shared_context)), |
| 53 j_return_texture_method_(GetMethodID(jni, | 53 j_return_texture_method_(GetMethodID(jni, |
| 54 *j_surface_texture_helper_class_, | 54 *j_surface_texture_helper_class_, |
| 55 "returnTextureFrame", | 55 "returnTextureFrame", |
| 56 "()V")) { | 56 "()V")) { |
| 57 CHECK_EXCEPTION(jni) << "error during initialization of SurfaceTextureHelper"; | 57 CHECK_EXCEPTION(jni) << "error during initialization of SurfaceTextureHelper"; |
| 58 } | 58 } |
| 59 | 59 |
| 60 SurfaceTextureHelper::~SurfaceTextureHelper() { | 60 SurfaceTextureHelper::~SurfaceTextureHelper() { |
| 61 } | 61 } |
| 62 | 62 |
| 63 void SurfaceTextureHelper::ReturnTextureFrame() const { | 63 void SurfaceTextureHelper::ReturnTextureFrame() const { |
| 64 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 64 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
| 65 jni->CallVoidMethod(*j_surface_texture_helper_, j_return_texture_method_); | 65 jni->CallVoidMethod(*j_surface_texture_helper_, j_return_texture_method_); |
| 66 | 66 |
| 67 CHECK_EXCEPTION( | 67 CHECK_EXCEPTION( |
| 68 jni) << "error during SurfaceTextureHelper.returnTextureFrame"; | 68 jni) << "error during SurfaceTextureHelper.returnTextureFrame"; |
| 69 } | 69 } |
| 70 | 70 |
| 71 rtc::scoped_refptr<webrtc::VideoFrameBuffer> | 71 rtc::scoped_refptr<webrtc::VideoFrameBuffer> |
| 72 SurfaceTextureHelper::CreateTextureFrame(int width, int height, | 72 SurfaceTextureHelper::CreateTextureFrame(int width, int height, |
| 73 const NativeHandleImpl& native_handle) { | 73 const NativeHandleImpl& native_handle) { |
| 74 return new rtc::RefCountedObject<AndroidTextureBuffer>( | 74 return new rtc::RefCountedObject<AndroidTextureBuffer>( |
| 75 width, height, native_handle, | 75 width, height, native_handle, |
| 76 rtc::Bind(&SurfaceTextureHelper::ReturnTextureFrame, this)); | 76 rtc::Bind(&SurfaceTextureHelper::ReturnTextureFrame, this)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace webrtc_jni | 79 } // namespace webrtc_jni |
| OLD | NEW |