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

Side by Side Diff: media/base/android/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
« no previous file with comments | « media/base/android/media_codec_bridge.h ('k') | media/base/android/ndk_media_codec_bridge.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/media_codec_bridge.h" 5 #include "media/base/android/media_codec_bridge.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/android/build_info.h" 10 #include "base/android/build_info.h"
(...skipping 24 matching lines...) Expand all
35 const std::string& iv, 35 const std::string& iv,
36 const std::vector<SubsampleEntry>& subsamples, 36 const std::vector<SubsampleEntry>& subsamples,
37 const base::TimeDelta& presentation_time) { 37 const base::TimeDelta& presentation_time) {
38 const std::vector<char> key_vec(key_id.begin(), key_id.end()); 38 const std::vector<char> key_vec(key_id.begin(), key_id.end());
39 const std::vector<char> iv_vec(iv.begin(), iv.end()); 39 const std::vector<char> iv_vec(iv.begin(), iv.end());
40 return QueueSecureInputBuffer(index, data, data_size, key_vec, iv_vec, 40 return QueueSecureInputBuffer(index, data, data_size, key_vec, iv_vec,
41 subsamples.empty() ? nullptr : &subsamples[0], 41 subsamples.empty() ? nullptr : &subsamples[0],
42 subsamples.size(), presentation_time); 42 subsamples.size(), presentation_time);
43 } 43 }
44 44
45 MediaCodecStatus MediaCodecBridge::CopyFromOutputBuffer(int index,
46 size_t offset,
47 void* dst,
48 size_t num) {
49 const uint8_t* src_data = nullptr;
50 size_t src_capacity = 0;
51 MediaCodecStatus status =
52 GetOutputBufferAddress(index, offset, &src_data, &src_capacity);
53 if (status == MEDIA_CODEC_OK) {
54 CHECK_GE(src_capacity, num);
55 memcpy(dst, src_data, num);
56 }
57 return status;
58 }
59
45 bool MediaCodecBridge::FillInputBuffer(int index, 60 bool MediaCodecBridge::FillInputBuffer(int index,
46 const uint8_t* data, 61 const uint8_t* data,
47 size_t size) { 62 size_t size) {
48 uint8_t* dst = nullptr; 63 uint8_t* dst = nullptr;
49 size_t capacity = 0; 64 size_t capacity = 0;
50 if (GetInputBuffer(index, &dst, &capacity) != MEDIA_CODEC_OK) { 65 if (GetInputBuffer(index, &dst, &capacity) != MEDIA_CODEC_OK) {
51 LOG(ERROR) << "GetInputBuffer failed"; 66 LOG(ERROR) << "GetInputBuffer failed";
52 return false; 67 return false;
53 } 68 }
54 CHECK(dst); 69 CHECK(dst);
55 70
56 if (size > capacity) { 71 if (size > capacity) {
57 LOG(ERROR) << "Input buffer size " << size 72 LOG(ERROR) << "Input buffer size " << size
58 << " exceeds MediaCodec input buffer capacity: " << capacity; 73 << " exceeds MediaCodec input buffer capacity: " << capacity;
59 return false; 74 return false;
60 } 75 }
61 76
62 memcpy(dst, data, size); 77 memcpy(dst, data, size);
63 return true; 78 return true;
64 } 79 }
65 80
66 } // namespace media 81 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_codec_bridge.h ('k') | media/base/android/ndk_media_codec_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698