Index: talk/app/webrtc/java/jni/native_handle_impl.h |
diff --git a/talk/app/webrtc/java/jni/native_handle_impl.h b/talk/app/webrtc/java/jni/native_handle_impl.h |
index 16d3d7cdde5e5300eb521c9727beaedda5c16048..dd04bc20b131833b376ca8828255e6fafcc38a9e 100644 |
--- a/talk/app/webrtc/java/jni/native_handle_impl.h |
+++ b/talk/app/webrtc/java/jni/native_handle_impl.h |
@@ -36,26 +36,51 @@ |
namespace webrtc_jni { |
// Wrapper for texture object. |
-struct NativeHandleImpl { |
- NativeHandleImpl(JNIEnv* jni, |
- jint j_oes_texture_id, |
- jfloatArray j_transform_matrix); |
+struct NativeTextureHandleImpl { |
+ NativeTextureHandleImpl(JNIEnv* jni, |
+ jint j_oes_texture_id, |
+ jfloatArray j_transform_matrix); |
const int oes_texture_id; |
float sampling_matrix[16]; |
}; |
+// Native handle for SurfaceTexture + texture id. |
+class NativeHandleImpl { |
+ public: |
+ NativeHandleImpl(); |
+ |
+ void* GetHandle(); |
+ int GetTextureId(); |
+ void SetTextureObject(void* texture_object, int texture_id); |
+ |
+ private: |
+ jobject texture_object_; |
+ int32_t texture_id_; |
+}; |
+ |
+class JniNativeHandleBuffer : public webrtc::NativeHandleBuffer { |
+ public: |
+ JniNativeHandleBuffer(void* native_handle, int width, int height); |
+ |
+ // TODO(pbos): Override destructor to release native handle, at the moment the |
+ // native handle is not released based on refcount. |
+ |
+ private: |
+ rtc::scoped_refptr<webrtc::VideoFrameBuffer> NativeToI420Buffer() override; |
+}; |
+ |
class AndroidTextureBuffer : public webrtc::NativeHandleBuffer { |
public: |
AndroidTextureBuffer(int width, |
int height, |
- const NativeHandleImpl& native_handle, |
+ const NativeTextureHandleImpl& native_handle, |
const rtc::Callback0<void>& no_longer_used); |
~AndroidTextureBuffer(); |
rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; |
private: |
- NativeHandleImpl native_handle_; |
+ NativeTextureHandleImpl native_handle_; |
rtc::Callback0<void> no_longer_used_cb_; |
}; |