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

Side by Side Diff: webrtc/sdk/android/src/jni/native_handle_impl.cc

Issue 2622263002: Delete deprecated and transitional stuff related to video frame refactoring. (Closed)
Patch Set: Fix include order. Add dependency in api/video_codecs/BUILD.gn. Created 3 years, 7 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 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/sdk/android/src/jni/native_handle_impl.h" 11 #include "webrtc/sdk/android/src/jni/native_handle_impl.h"
12 12
13 #include <memory> 13 #include <memory>
14 14
15 #include "webrtc/sdk/android/src/jni/jni_helpers.h" 15 #include "webrtc/api/video/i420_buffer.h"
16 #include "webrtc/base/bind.h" 16 #include "webrtc/base/bind.h"
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/base/keep_ref_until_done.h" 18 #include "webrtc/base/keep_ref_until_done.h"
19 #include "webrtc/base/logging.h" 19 #include "webrtc/base/logging.h"
20 #include "webrtc/base/scoped_ref_ptr.h" 20 #include "webrtc/base/scoped_ref_ptr.h"
21 #include "webrtc/sdk/android/src/jni/jni_helpers.h"
21 22
22 using webrtc::NativeHandleBuffer; 23 using webrtc::NativeHandleBuffer;
23 24
24 namespace webrtc_jni { 25 namespace webrtc_jni {
25 26
26 Matrix::Matrix(JNIEnv* jni, jfloatArray a) { 27 Matrix::Matrix(JNIEnv* jni, jfloatArray a) {
27 RTC_CHECK_EQ(16, jni->GetArrayLength(a)); 28 RTC_CHECK_EQ(16, jni->GetArrayLength(a));
28 jfloat* ptr = jni->GetFloatArrayElements(a, nullptr); 29 jfloat* ptr = jni->GetFloatArrayElements(a, nullptr);
29 for (int i = 0; i < 16; ++i) { 30 for (int i = 0; i < 16; ++i) {
30 elem_[i] = ptr[i]; 31 elem_[i] = ptr[i];
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 AndroidTextureBuffer::NativeToI420Buffer() { 136 AndroidTextureBuffer::NativeToI420Buffer() {
136 int uv_width = (width()+7) / 8; 137 int uv_width = (width()+7) / 8;
137 int stride = 8 * uv_width; 138 int stride = 8 * uv_width;
138 int uv_height = (height()+1)/2; 139 int uv_height = (height()+1)/2;
139 size_t size = stride * (height() + uv_height); 140 size_t size = stride * (height() + uv_height);
140 // The data is owned by the frame, and the normal case is that the 141 // The data is owned by the frame, and the normal case is that the
141 // data is deleted by the frame's destructor callback. 142 // data is deleted by the frame's destructor callback.
142 // 143 //
143 // TODO(nisse): Use an I420BufferPool. We then need to extend that 144 // TODO(nisse): Use an I420BufferPool. We then need to extend that
144 // class, and I420Buffer, to support our memory layout. 145 // class, and I420Buffer, to support our memory layout.
146 // TODO(nisse): Depending on
147 // system_wrappers/include/aligned_malloc.h violate current DEPS
148 // rules. We get away for now only because it is indirectly included
149 // by i420_buffer.h
145 std::unique_ptr<uint8_t, webrtc::AlignedFreeDeleter> yuv_data( 150 std::unique_ptr<uint8_t, webrtc::AlignedFreeDeleter> yuv_data(
146 static_cast<uint8_t*>(webrtc::AlignedMalloc(size, kBufferAlignment))); 151 static_cast<uint8_t*>(webrtc::AlignedMalloc(size, kBufferAlignment)));
147 // See YuvConverter.java for the required layout. 152 // See YuvConverter.java for the required layout.
148 uint8_t* y_data = yuv_data.get(); 153 uint8_t* y_data = yuv_data.get();
149 uint8_t* u_data = y_data + height() * stride; 154 uint8_t* u_data = y_data + height() * stride;
150 uint8_t* v_data = u_data + stride/2; 155 uint8_t* v_data = u_data + stride/2;
151 156
152 rtc::scoped_refptr<webrtc::VideoFrameBuffer> copy = 157 rtc::scoped_refptr<webrtc::VideoFrameBuffer> copy =
153 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( 158 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>(
154 width(), height(), 159 width(), height(),
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 cropped_width / static_cast<float>(width()), 211 cropped_width / static_cast<float>(width()),
207 cropped_height / static_cast<float>(height()), 212 cropped_height / static_cast<float>(height()),
208 crop_x / static_cast<float>(width()), 213 crop_x / static_cast<float>(width()),
209 crop_y / static_cast<float>(height())); 214 crop_y / static_cast<float>(height()));
210 } 215 }
211 buffer->native_handle_.sampling_matrix.Rotate(rotation); 216 buffer->native_handle_.sampling_matrix.Rotate(rotation);
212 return buffer; 217 return buffer;
213 } 218 }
214 219
215 } // namespace webrtc_jni 220 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/generic_decoder.cc ('k') | webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698