Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: talk/app/webrtc/java/jni/native_handle_impl.h

Issue 1441363002: Revert of Android MediaCodecVideoDecoder: Manage lifetime of texture frames (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Manual revert. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
29 #ifndef TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ 29 #ifndef TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_
30 #define TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ 30 #define TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_
31 31
32 #include <jni.h> 32 #include <jni.h>
33 33
34 #include "webrtc/common_video/interface/video_frame_buffer.h" 34 #include "webrtc/common_video/interface/video_frame_buffer.h"
35 35
36 namespace webrtc_jni { 36 namespace webrtc_jni {
37 37
38 // Wrapper for texture object. 38 // Wrapper for texture object.
39 struct NativeHandleImpl { 39 struct NativeTextureHandleImpl {
40 NativeHandleImpl(JNIEnv* jni, 40 NativeTextureHandleImpl(JNIEnv* jni,
41 jint j_oes_texture_id, 41 jint j_oes_texture_id,
42 jfloatArray j_transform_matrix); 42 jfloatArray j_transform_matrix);
43 43
44 const int oes_texture_id; 44 const int oes_texture_id;
45 float sampling_matrix[16]; 45 float sampling_matrix[16];
46 }; 46 };
47 47
48 // Native handle for SurfaceTexture + texture id.
49 class NativeHandleImpl {
50 public:
51 NativeHandleImpl();
52
53 void* GetHandle();
54 int GetTextureId();
55 void SetTextureObject(void* texture_object, int texture_id);
56
57 private:
58 jobject texture_object_;
59 int32_t texture_id_;
60 };
61
62 class JniNativeHandleBuffer : public webrtc::NativeHandleBuffer {
63 public:
64 JniNativeHandleBuffer(void* native_handle, int width, int height);
65
66 // TODO(pbos): Override destructor to release native handle, at the moment the
67 // native handle is not released based on refcount.
68
69 private:
70 rtc::scoped_refptr<webrtc::VideoFrameBuffer> NativeToI420Buffer() override;
71 };
72
48 class AndroidTextureBuffer : public webrtc::NativeHandleBuffer { 73 class AndroidTextureBuffer : public webrtc::NativeHandleBuffer {
49 public: 74 public:
50 AndroidTextureBuffer(int width, 75 AndroidTextureBuffer(int width,
51 int height, 76 int height,
52 const NativeHandleImpl& native_handle, 77 const NativeTextureHandleImpl& native_handle,
53 const rtc::Callback0<void>& no_longer_used); 78 const rtc::Callback0<void>& no_longer_used);
54 ~AndroidTextureBuffer(); 79 ~AndroidTextureBuffer();
55 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; 80 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
56 81
57 private: 82 private:
58 NativeHandleImpl native_handle_; 83 NativeTextureHandleImpl native_handle_;
59 rtc::Callback0<void> no_longer_used_cb_; 84 rtc::Callback0<void> no_longer_used_cb_;
60 }; 85 };
61 86
62 } // namespace webrtc_jni 87 } // namespace webrtc_jni
63 88
64 #endif // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ 89 #endif // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/jni/classreferenceholder.cc ('k') | talk/app/webrtc/java/jni/native_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698