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

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

Issue 1378033003: Android MediaCodecVideoDecoder: Manage lifetime of texture frames (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add comment about disconnect() and synchronization Created 5 years, 2 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 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() : texture_object_(NULL), texture_id_(-1) {} 34 NativeHandleImpl::NativeHandleImpl(JNIEnv* jni,
35 35 jint j_oes_texture_id,
36 void* NativeHandleImpl::GetHandle() { 36 jfloatArray j_transform_matrix)
37 return texture_object_; 37 : oes_texture_id(j_oes_texture_id) {
38 } 38 RTC_CHECK_EQ(16, jni->GetArrayLength(j_transform_matrix));
39 39 jfloat* transform_matrix_ptr =
40 int NativeHandleImpl::GetTextureId() { 40 jni->GetFloatArrayElements(j_transform_matrix, nullptr);
41 return texture_id_; 41 for (int i = 0; i < 16; ++i) {
42 } 42 sampling_matrix[i] = transform_matrix_ptr[i];
43 43 }
44 void NativeHandleImpl::SetTextureObject(void* texture_object, int texture_id) { 44 jni->ReleaseFloatArrayElements(j_transform_matrix, transform_matrix_ptr, 0);
45 texture_object_ = reinterpret_cast<jobject>(texture_object);
46 texture_id_ = texture_id;
47 }
48
49 JniNativeHandleBuffer::JniNativeHandleBuffer(void* native_handle,
50 int width,
51 int height)
52 : NativeHandleBuffer(native_handle, width, height) {}
53
54 rtc::scoped_refptr<webrtc::VideoFrameBuffer>
55 JniNativeHandleBuffer::NativeToI420Buffer() {
56 // TODO(pbos): Implement before using this in the encoder pipeline (or
57 // remove the RTC_CHECK() in VideoCapture).
58 RTC_NOTREACHED();
59 return nullptr;
60 } 45 }
61 46
62 } // namespace webrtc_jni 47 } // 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