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

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

Issue 2672313006: media: Remove the unused NdkMediaCodecBridge (Closed)
Patch Set: rebase past conflict Created 3 years, 10 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_bridge_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "media/base/android/media_codec_bridge.h"
6
7 #include <algorithm>
8 #include <limits>
9
10 #include "base/logging.h"
11 #include "base/strings/string_util.h"
12 #include "media/base/subsample_entry.h"
13
14 namespace media {
15
16 MediaCodecBridge::MediaCodecBridge() {}
17
18 MediaCodecBridge::~MediaCodecBridge() {}
19
20 MediaCodecStatus MediaCodecBridge::QueueSecureInputBuffer(
21 int index,
22 const uint8_t* data,
23 size_t data_size,
24 const std::string& key_id,
25 const std::string& iv,
26 const std::vector<SubsampleEntry>& subsamples,
27 const EncryptionScheme& encryption_scheme,
28 base::TimeDelta presentation_time) {
29 const std::vector<char> key_vec(key_id.begin(), key_id.end());
30 const std::vector<char> iv_vec(iv.begin(), iv.end());
31 return QueueSecureInputBuffer(index, data, data_size, key_vec, iv_vec,
32 subsamples.empty() ? nullptr : &subsamples[0],
33 (int)subsamples.size(), encryption_scheme,
34 presentation_time);
35 }
36
37 MediaCodecStatus MediaCodecBridge::CopyFromOutputBuffer(int index,
38 size_t offset,
39 void* dst,
40 size_t num) {
41 const uint8_t* src_data = nullptr;
42 size_t src_capacity = 0;
43 MediaCodecStatus status =
44 GetOutputBufferAddress(index, offset, &src_data, &src_capacity);
45 if (status == MEDIA_CODEC_OK) {
46 CHECK_GE(src_capacity, num);
47 memcpy(dst, src_data, num);
48 }
49 return status;
50 }
51
52 bool MediaCodecBridge::FillInputBuffer(int index,
53 const uint8_t* data,
54 size_t size) {
55 uint8_t* dst = nullptr;
56 size_t capacity = 0;
57 if (GetInputBuffer(index, &dst, &capacity) != MEDIA_CODEC_OK) {
58 LOG(ERROR) << "GetInputBuffer failed";
59 return false;
60 }
61 CHECK(dst);
62
63 if (size > capacity) {
64 LOG(ERROR) << "Input buffer size " << size
65 << " exceeds MediaCodec input buffer capacity: " << capacity;
66 return false;
67 }
68
69 memcpy(dst, data, size);
70 return true;
71 }
72
73 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_codec_bridge.h ('k') | media/base/android/media_codec_bridge_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698