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

Side by Side Diff: media/base/android/ndk_media_codec_bridge.cc

Issue 1932093002: Reland: Use actual audio channel count in Spitzer audio decoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bug607024
Patch Set: Fix the use of out.offset: decoded data size does not depend on it. Created 4 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/android/ndk_media_codec_bridge.h" 5 #include "media/base/android/ndk_media_codec_bridge.h"
6 6
7 #include <media/NdkMediaError.h> 7 #include <media/NdkMediaError.h>
8 #include <media/NdkMediaFormat.h> 8 #include <media/NdkMediaFormat.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 230 }
231 231
232 MediaCodecStatus NdkMediaCodecBridge::GetInputBuffer(int input_buffer_index, 232 MediaCodecStatus NdkMediaCodecBridge::GetInputBuffer(int input_buffer_index,
233 uint8_t** data, 233 uint8_t** data,
234 size_t* capacity) { 234 size_t* capacity) {
235 *data = AMediaCodec_getInputBuffer(media_codec_.get(), input_buffer_index, 235 *data = AMediaCodec_getInputBuffer(media_codec_.get(), input_buffer_index,
236 capacity); 236 capacity);
237 return MEDIA_CODEC_OK; 237 return MEDIA_CODEC_OK;
238 } 238 }
239 239
240 MediaCodecStatus NdkMediaCodecBridge::CopyFromOutputBuffer(int index, 240 MediaCodecStatus NdkMediaCodecBridge::GetOutputBufferAddress(
241 size_t offset, 241 int index,
242 void* dst, 242 size_t offset,
243 size_t num) { 243 const uint8_t** addr,
244 size_t capacity; 244 size_t* capacity) {
245 const uint8_t* src_data = 245 const uint8_t* src_data =
246 AMediaCodec_getOutputBuffer(media_codec_.get(), index, &capacity); 246 AMediaCodec_getOutputBuffer(media_codec_.get(), index, capacity);
247 CHECK_GE(capacity, offset + num); 247 *addr = src_data + offset;
248 memcpy(dst, src_data + offset, num); 248 *capacity -= offset;
249 return MEDIA_CODEC_OK; 249 return MEDIA_CODEC_OK;
250 } 250 }
251 251
252 } // namespace media 252 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/ndk_media_codec_bridge.h ('k') | media/base/android/sdk_media_codec_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698