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

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

Issue 1158273010: Re-land "Convert native handles to buffers before encoding." (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 months 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 11 matching lines...) Expand all
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"
33 #include "webrtc/common_video/interface/video_frame_buffer.h"
34
32 namespace webrtc_jni { 35 namespace webrtc_jni {
33 36
34 // Wrapper for texture object. 37 // Wrapper for texture object.
35 class NativeHandleImpl { 38 class NativeHandleImpl {
36 public: 39 public:
37 NativeHandleImpl() : texture_object_(NULL), texture_id_(-1) {} 40 NativeHandleImpl() : texture_object_(NULL), texture_id_(-1) {}
38 41
39 void* GetHandle() { 42 void* GetHandle() {
40 return texture_object_; 43 return texture_object_;
41 } 44 }
42 int GetTextureId() { 45 int GetTextureId() {
43 return texture_id_; 46 return texture_id_;
44 } 47 }
45 void SetTextureObject(void *texture_object, int texture_id) { 48 void SetTextureObject(void *texture_object, int texture_id) {
46 texture_object_ = reinterpret_cast<jobject>(texture_object); 49 texture_object_ = reinterpret_cast<jobject>(texture_object);
47 texture_id_ = texture_id; 50 texture_id_ = texture_id;
48 } 51 }
49 52
50 private: 53 private:
51 jobject texture_object_; 54 jobject texture_object_;
52 int32_t texture_id_; 55 int32_t texture_id_;
53 }; 56 };
54 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 CHECK() in VideoCapture).
70 RTC_NOTREACHED();
71 return nullptr;
72 }
73 };
74
55 } // namespace webrtc_jni 75 } // namespace webrtc_jni
56 76
57 #endif // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ 77 #endif // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/jni/androidmediadecoder_jni.cc ('k') | talk/media/webrtc/webrtcvideoframe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698