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

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

Issue 2132653002: MediaCodecLoop unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cl feedback Created 4 years, 4 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/media_codec_direction.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"
11 #include "base/android/jni_android.h"
12 #include "base/android/jni_array.h"
13 #include "base/android/jni_string.h"
14 #include "base/logging.h" 10 #include "base/logging.h"
15 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
16 #include "media/base/decrypt_config.h" 12 #include "media/base/subsample_entry.h"
17
18 using base::android::AttachCurrentThread;
19 using base::android::ConvertJavaStringToUTF8;
20 using base::android::ConvertUTF8ToJavaString;
21 using base::android::JavaIntArrayToIntVector;
22 using base::android::ScopedJavaLocalRef;
23 13
24 namespace media { 14 namespace media {
25 15
26 MediaCodecBridge::MediaCodecBridge() {} 16 MediaCodecBridge::MediaCodecBridge() {}
27 17
28 MediaCodecBridge::~MediaCodecBridge() {} 18 MediaCodecBridge::~MediaCodecBridge() {}
29 19
30 MediaCodecStatus MediaCodecBridge::QueueSecureInputBuffer( 20 MediaCodecStatus MediaCodecBridge::QueueSecureInputBuffer(
31 int index, 21 int index,
32 const uint8_t* data, 22 const uint8_t* data,
33 size_t data_size, 23 size_t data_size,
34 const std::string& key_id, 24 const std::string& key_id,
35 const std::string& iv, 25 const std::string& iv,
36 const std::vector<SubsampleEntry>& subsamples, 26 const std::vector<SubsampleEntry>& subsamples,
37 base::TimeDelta presentation_time) { 27 base::TimeDelta presentation_time) {
38 const std::vector<char> key_vec(key_id.begin(), key_id.end()); 28 const std::vector<char> key_vec(key_id.begin(), key_id.end());
39 const std::vector<char> iv_vec(iv.begin(), iv.end()); 29 const std::vector<char> iv_vec(iv.begin(), iv.end());
40 return QueueSecureInputBuffer(index, data, data_size, key_vec, iv_vec, 30 return QueueSecureInputBuffer(index, data, data_size, key_vec, iv_vec,
41 subsamples.empty() ? nullptr : &subsamples[0], 31 subsamples.empty() ? nullptr : &subsamples[0],
42 subsamples.size(), presentation_time); 32 (int)subsamples.size(), presentation_time);
43 } 33 }
44 34
45 MediaCodecStatus MediaCodecBridge::CopyFromOutputBuffer(int index, 35 MediaCodecStatus MediaCodecBridge::CopyFromOutputBuffer(int index,
46 size_t offset, 36 size_t offset,
47 void* dst, 37 void* dst,
48 size_t num) { 38 size_t num) {
49 const uint8_t* src_data = nullptr; 39 const uint8_t* src_data = nullptr;
50 size_t src_capacity = 0; 40 size_t src_capacity = 0;
51 MediaCodecStatus status = 41 MediaCodecStatus status =
52 GetOutputBufferAddress(index, offset, &src_data, &src_capacity); 42 GetOutputBufferAddress(index, offset, &src_data, &src_capacity);
(...skipping 19 matching lines...) Expand all
72 LOG(ERROR) << "Input buffer size " << size 62 LOG(ERROR) << "Input buffer size " << size
73 << " exceeds MediaCodec input buffer capacity: " << capacity; 63 << " exceeds MediaCodec input buffer capacity: " << capacity;
74 return false; 64 return false;
75 } 65 }
76 66
77 memcpy(dst, data, size); 67 memcpy(dst, data, size);
78 return true; 68 return true;
79 } 69 }
80 70
81 } // namespace media 71 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_codec_bridge.h ('k') | media/base/android/media_codec_direction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698