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 | |
33 #include "webrtc/common_video/interface/video_frame_buffer.h" | 34 #include "webrtc/common_video/interface/video_frame_buffer.h" |
34 | 35 |
35 namespace webrtc_jni { | 36 namespace webrtc_jni { |
36 | 37 |
37 // Wrapper for texture object. | 38 // Wrapper for texture object. |
38 class NativeHandleImpl { | 39 class NativeHandleImpl { |
39 public: | 40 public: |
40 NativeHandleImpl() : texture_object_(NULL), texture_id_(-1) {} | 41 NativeHandleImpl(); |
41 | 42 |
42 void* GetHandle() { | 43 void* GetHandle(); |
43 return texture_object_; | 44 int GetTextureId(); |
hbos
2015/10/02 08:58:30
Make getters const?
magjed_webrtc
2015/10/02 09:35:12
I don't want to make any unrelated changes in this
hbos
2015/10/02 11:02:58
http://f.tqn.com/y/webtrends/1/L/G/D/-/-/Okay_guy.
| |
44 } | 45 void SetTextureObject(void* texture_object, int texture_id); |
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 | 46 |
53 private: | 47 private: |
54 jobject texture_object_; | 48 jobject texture_object_; |
55 int32_t texture_id_; | 49 int32_t texture_id_; |
56 }; | 50 }; |
57 | 51 |
58 class JniNativeHandleBuffer : public webrtc::NativeHandleBuffer { | 52 class JniNativeHandleBuffer : public webrtc::NativeHandleBuffer { |
59 public: | 53 public: |
60 JniNativeHandleBuffer(void* native_handle, int width, int height) | 54 JniNativeHandleBuffer(void* native_handle, int width, int height); |
61 : NativeHandleBuffer(native_handle, width, height) {} | |
62 | 55 |
63 // TODO(pbos): Override destructor to release native handle, at the moment the | 56 // TODO(pbos): Override destructor to release native handle, at the moment the |
64 // native handle is not released based on refcount. | 57 // native handle is not released based on refcount. |
65 | 58 |
66 private: | 59 private: |
67 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override { | 60 rtc::scoped_refptr<webrtc::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 }; | 61 }; |
74 | 62 |
75 } // namespace webrtc_jni | 63 } // namespace webrtc_jni |
76 | 64 |
77 #endif // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ | 65 #endif // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ |
OLD | NEW |