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, | 41 // Might return null if creating the Java SurfaceTextureHelper fails. |
42 const char* thread_name, | 42 static rtc::scoped_refptr<SurfaceTextureHelper> create( |
43 jobject j_egl_context); | 43 JNIEnv* jni, const char* thread_name, jobject j_egl_context); |
44 | 44 |
45 jobject GetJavaSurfaceTextureHelper() const; | 45 jobject GetJavaSurfaceTextureHelper() const; |
46 | 46 |
47 rtc::scoped_refptr<webrtc::VideoFrameBuffer> CreateTextureFrame( | 47 rtc::scoped_refptr<webrtc::VideoFrameBuffer> CreateTextureFrame( |
48 int width, | 48 int width, |
49 int height, | 49 int height, |
50 const NativeHandleImpl& native_handle); | 50 const NativeHandleImpl& native_handle); |
51 | 51 |
52 protected: | 52 protected: |
53 ~SurfaceTextureHelper(); | 53 ~SurfaceTextureHelper(); |
| 54 SurfaceTextureHelper(JNIEnv* jni, jobject j_surface_texture_helper); |
54 | 55 |
55 private: | 56 private: |
56 // May be called on arbitrary thread. | 57 // May be called on arbitrary thread. |
57 void ReturnTextureFrame() const; | 58 void ReturnTextureFrame() const; |
58 | 59 |
59 const ScopedGlobalRef<jobject> j_surface_texture_helper_; | 60 const ScopedGlobalRef<jobject> j_surface_texture_helper_; |
60 const jmethodID j_return_texture_method_; | 61 const jmethodID j_return_texture_method_; |
61 }; | 62 }; |
62 | 63 |
63 } // namespace webrtc_jni | 64 } // namespace webrtc_jni |
64 | 65 |
65 #endif // WEBRTC_API_JAVA_JNI_SURFACETEXTUREHELPER_JNI_H_ | 66 #endif // WEBRTC_API_JAVA_JNI_SURFACETEXTUREHELPER_JNI_H_ |
OLD | NEW |