| 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 // Helper class to create and synchronize access to an Android SurfaceTexture. | 24 // Helper class to create and synchronize access to an Android SurfaceTexture. |
| 25 // It is used for creating webrtc::VideoFrameBuffers from a SurfaceTexture when | 25 // It is used for creating webrtc::VideoFrameBuffers from a SurfaceTexture when |
| 26 // the SurfaceTexture has been updated. | 26 // the SurfaceTexture has been updated. |
| 27 // When the VideoFrameBuffer is released, this class returns the buffer to the | 27 // When the VideoFrameBuffer is released, this class returns the buffer to the |
| 28 // java SurfaceTextureHelper so it can be updated safely. The VideoFrameBuffer | 28 // java SurfaceTextureHelper so it can be updated safely. The VideoFrameBuffer |
| 29 // can be released on an arbitrary thread. | 29 // can be released on an arbitrary thread. |
| 30 // SurfaceTextureHelper is reference counted to make sure that it is not | 30 // SurfaceTextureHelper is reference counted to make sure that it is not |
| 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 // It owns the corresponding java object, and calls the java dispose |
| 34 // method when destroyed. |
| 33 // Usage: | 35 // Usage: |
| 34 // 1. Create an instance of this class. | 36 // 1. Create an instance of this class. |
| 35 // 2. Get the Java SurfaceTextureHelper with GetJavaSurfaceTextureHelper(). | 37 // 2. Get the Java SurfaceTextureHelper with GetJavaSurfaceTextureHelper(). |
| 36 // 3. Register a listener to the Java SurfaceListener and start producing | 38 // 3. Register a listener to the Java SurfaceListener and start producing |
| 37 // new buffers. | 39 // new buffers. |
| 38 // 4. Call CreateTextureFrame to wrap the Java texture in a VideoFrameBuffer. | 40 // 4. Call CreateTextureFrame to wrap the Java texture in a VideoFrameBuffer. |
| 39 class SurfaceTextureHelper : public rtc::RefCountInterface { | 41 class SurfaceTextureHelper : public rtc::RefCountInterface { |
| 40 public: | 42 public: |
| 41 // Might return null if creating the Java SurfaceTextureHelper fails. | 43 // Might return null if creating the Java SurfaceTextureHelper fails. |
| 42 static rtc::scoped_refptr<SurfaceTextureHelper> create( | 44 static rtc::scoped_refptr<SurfaceTextureHelper> create( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 57 // May be called on arbitrary thread. | 59 // May be called on arbitrary thread. |
| 58 void ReturnTextureFrame() const; | 60 void ReturnTextureFrame() const; |
| 59 | 61 |
| 60 const ScopedGlobalRef<jobject> j_surface_texture_helper_; | 62 const ScopedGlobalRef<jobject> j_surface_texture_helper_; |
| 61 const jmethodID j_return_texture_method_; | 63 const jmethodID j_return_texture_method_; |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 } // namespace webrtc_jni | 66 } // namespace webrtc_jni |
| 65 | 67 |
| 66 #endif // WEBRTC_API_JAVA_JNI_SURFACETEXTUREHELPER_JNI_H_ | 68 #endif // WEBRTC_API_JAVA_JNI_SURFACETEXTUREHELPER_JNI_H_ |
| OLD | NEW |