| OLD | NEW | 
|---|
| 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 11 matching lines...) Expand all  Loading... | 
| 22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 
| 23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 
| 24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 
| 25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| 26  * | 26  * | 
| 27  */ | 27  */ | 
| 28 | 28 | 
| 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 "webrtc/base/checks.h" | 32 #include <jni.h> | 
| 33 #include "webrtc/common_video/interface/video_frame_buffer.h" |  | 
| 34 | 33 | 
| 35 namespace webrtc_jni { | 34 namespace webrtc_jni { | 
| 36 | 35 | 
| 37 // Wrapper for texture object. | 36 // Wrapper for texture object. | 
| 38 class NativeHandleImpl { | 37 struct NativeHandleImpl { | 
| 39  public: | 38   NativeHandleImpl(JNIEnv* jni, | 
| 40   NativeHandleImpl() : texture_object_(NULL), texture_id_(-1) {} | 39                    jint j_oes_texture_id, | 
|  | 40                    jfloatArray j_transform_matrix); | 
| 41 | 41 | 
| 42   void* GetHandle() { | 42   const int oes_texture_id; | 
| 43     return texture_object_; | 43   float sampling_matrix[16]; | 
| 44   } |  | 
| 45   int GetTextureId() { |  | 
| 46     return texture_id_; |  | 
| 47   } |  | 
| 48   void SetTextureObject(void *texture_object, int texture_id) { |  | 
| 49     texture_object_ = reinterpret_cast<jobject>(texture_object); |  | 
| 50     texture_id_ = texture_id; |  | 
| 51   } |  | 
| 52 |  | 
| 53  private: |  | 
| 54   jobject texture_object_; |  | 
| 55   int32_t texture_id_; |  | 
| 56 }; |  | 
| 57 |  | 
| 58 class JniNativeHandleBuffer : public webrtc::NativeHandleBuffer { |  | 
| 59  public: |  | 
| 60   JniNativeHandleBuffer(void* native_handle, int width, int height) |  | 
| 61       : NativeHandleBuffer(native_handle, width, height) {} |  | 
| 62 |  | 
| 63   // TODO(pbos): Override destructor to release native handle, at the moment the |  | 
| 64   // native handle is not released based on refcount. |  | 
| 65 |  | 
| 66  private: |  | 
| 67   rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override { |  | 
| 68     // TODO(pbos): Implement before using this in the encoder pipeline (or |  | 
| 69     // remove the RTC_CHECK() in VideoCapture). |  | 
| 70     RTC_NOTREACHED(); |  | 
| 71     return nullptr; |  | 
| 72   } |  | 
| 73 }; | 44 }; | 
| 74 | 45 | 
| 75 }  // namespace webrtc_jni | 46 }  // namespace webrtc_jni | 
| 76 | 47 | 
| 77 #endif  // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ | 48 #endif  // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ | 
| OLD | NEW | 
|---|