| 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 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // destroyed while a VideoFrameBuffer is in use. | 31 // destroyed while a VideoFrameBuffer is in use. |
| 32 // This class is the C++ counterpart of the java class SurfaceTextureHelper. | 32 // This class is the C++ counterpart of the java class SurfaceTextureHelper. |
| 33 // Usage: | 33 // Usage: |
| 34 // 1. Create an instance of this class. | 34 // 1. Create an instance of this class. |
| 35 // 2. Get the Java SurfaceTextureHelper with GetJavaSurfaceTextureHelper(). | 35 // 2. Get the Java SurfaceTextureHelper with GetJavaSurfaceTextureHelper(). |
| 36 // 3. Register a listener to the Java SurfaceListener and start producing | 36 // 3. Register a listener to the Java SurfaceListener and start producing |
| 37 // new buffers. | 37 // new buffers. |
| 38 // 4. Call CreateTextureFrame to wrap the Java texture in a VideoFrameBuffer. | 38 // 4. Call CreateTextureFrame to wrap the Java texture in a VideoFrameBuffer. |
| 39 class SurfaceTextureHelper : public rtc::RefCountInterface { | 39 class SurfaceTextureHelper : public rtc::RefCountInterface { |
| 40 public: | 40 public: |
| 41 SurfaceTextureHelper(JNIEnv* jni, jobject j_egl_context); | 41 SurfaceTextureHelper(JNIEnv* jni, |
| 42 const char* thread_name, |
| 43 jobject j_egl_context); |
| 42 | 44 |
| 43 jobject GetJavaSurfaceTextureHelper() const; | 45 jobject GetJavaSurfaceTextureHelper() const; |
| 44 | 46 |
| 45 rtc::scoped_refptr<webrtc::VideoFrameBuffer> CreateTextureFrame( | 47 rtc::scoped_refptr<webrtc::VideoFrameBuffer> CreateTextureFrame( |
| 46 int width, | 48 int width, |
| 47 int height, | 49 int height, |
| 48 const NativeHandleImpl& native_handle); | 50 const NativeHandleImpl& native_handle); |
| 49 | 51 |
| 50 protected: | 52 protected: |
| 51 ~SurfaceTextureHelper(); | 53 ~SurfaceTextureHelper(); |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 // May be called on arbitrary thread. | 56 // May be called on arbitrary thread. |
| 55 void ReturnTextureFrame() const; | 57 void ReturnTextureFrame() const; |
| 56 | 58 |
| 57 const ScopedGlobalRef<jobject> j_surface_texture_helper_; | 59 const ScopedGlobalRef<jobject> j_surface_texture_helper_; |
| 58 const jmethodID j_return_texture_method_; | 60 const jmethodID j_return_texture_method_; |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 } // namespace webrtc_jni | 63 } // namespace webrtc_jni |
| 62 | 64 |
| 63 #endif // WEBRTC_API_JAVA_JNI_SURFACETEXTUREHELPER_JNI_H_ | 65 #endif // WEBRTC_API_JAVA_JNI_SURFACETEXTUREHELPER_JNI_H_ |
| OLD | NEW |