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

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

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 13 matching lines...) Expand all
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 #include "talk/app/webrtc/java/jni/native_handle_impl.h" 28 #include "talk/app/webrtc/java/jni/native_handle_impl.h"
29 29
30 #include "webrtc/base/checks.h" 30 #include "webrtc/base/checks.h"
31 31
32 namespace webrtc_jni { 32 namespace webrtc_jni {
33 33
34 NativeHandleImpl::NativeHandleImpl(JNIEnv* jni, 34 NativeTextureHandleImpl::NativeTextureHandleImpl(JNIEnv* jni,
35 jint j_oes_texture_id, 35 jint j_oes_texture_id,
36 jfloatArray j_transform_matrix) 36 jfloatArray j_transform_matrix)
37 : oes_texture_id(j_oes_texture_id) { 37 : oes_texture_id(j_oes_texture_id) {
38 RTC_CHECK_EQ(16, jni->GetArrayLength(j_transform_matrix)); 38 RTC_CHECK_EQ(16, jni->GetArrayLength(j_transform_matrix));
39 jfloat* transform_matrix_ptr = 39 jfloat* transform_matrix_ptr =
40 jni->GetFloatArrayElements(j_transform_matrix, nullptr); 40 jni->GetFloatArrayElements(j_transform_matrix, nullptr);
41 for (int i = 0; i < 16; ++i) { 41 for (int i = 0; i < 16; ++i) {
42 sampling_matrix[i] = transform_matrix_ptr[i]; 42 sampling_matrix[i] = transform_matrix_ptr[i];
43 } 43 }
44 jni->ReleaseFloatArrayElements(j_transform_matrix, transform_matrix_ptr, 0); 44 jni->ReleaseFloatArrayElements(j_transform_matrix, transform_matrix_ptr, 0);
45 } 45 }
46 46
47 NativeHandleImpl::NativeHandleImpl() : texture_object_(NULL), texture_id_(-1) {}
48
49 void* NativeHandleImpl::GetHandle() {
50 return texture_object_;
51 }
52
53 int NativeHandleImpl::GetTextureId() {
54 return texture_id_;
55 }
56
57 void NativeHandleImpl::SetTextureObject(void* texture_object, int texture_id) {
58 texture_object_ = reinterpret_cast<jobject>(texture_object);
59 texture_id_ = texture_id;
60 }
61
62 JniNativeHandleBuffer::JniNativeHandleBuffer(void* native_handle,
63 int width,
64 int height)
65 : NativeHandleBuffer(native_handle, width, height) {}
66
67 rtc::scoped_refptr<webrtc::VideoFrameBuffer>
68 JniNativeHandleBuffer::NativeToI420Buffer() {
69 // TODO(pbos): Implement before using this in the encoder pipeline (or
70 // remove the RTC_CHECK() in VideoCapture).
71 RTC_NOTREACHED();
72 return nullptr;
73 }
74
47 AndroidTextureBuffer::AndroidTextureBuffer( 75 AndroidTextureBuffer::AndroidTextureBuffer(
48 int width, 76 int width,
49 int height, 77 int height,
50 const NativeHandleImpl& native_handle, 78 const NativeTextureHandleImpl& native_handle,
51 const rtc::Callback0<void>& no_longer_used) 79 const rtc::Callback0<void>& no_longer_used)
52 : webrtc::NativeHandleBuffer(&native_handle_, width, height), 80 : webrtc::NativeHandleBuffer(&native_handle_, width, height),
53 native_handle_(native_handle), 81 native_handle_(native_handle),
54 no_longer_used_cb_(no_longer_used) {} 82 no_longer_used_cb_(no_longer_used) {}
55 83
56 AndroidTextureBuffer::~AndroidTextureBuffer() { 84 AndroidTextureBuffer::~AndroidTextureBuffer() {
57 no_longer_used_cb_(); 85 no_longer_used_cb_();
58 } 86 }
59 87
60 rtc::scoped_refptr<webrtc::VideoFrameBuffer> 88 rtc::scoped_refptr<webrtc::VideoFrameBuffer>
61 AndroidTextureBuffer::NativeToI420Buffer() { 89 AndroidTextureBuffer::NativeToI420Buffer() {
62 RTC_NOTREACHED() 90 RTC_NOTREACHED()
63 << "AndroidTextureBuffer::NativeToI420Buffer not implemented."; 91 << "AndroidTextureBuffer::NativeToI420Buffer not implemented.";
64 return nullptr; 92 return nullptr;
65 } 93 }
66 94
67 } // namespace webrtc_jni 95 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/jni/native_handle_impl.h ('k') | talk/app/webrtc/java/jni/peerconnection_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698