| OLD | NEW |
| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 MediaCodecStatus NdkMediaCodecBridge::QueueSecureInputBuffer( | 131 MediaCodecStatus NdkMediaCodecBridge::QueueSecureInputBuffer( |
| 132 int index, | 132 int index, |
| 133 const uint8_t* data, | 133 const uint8_t* data, |
| 134 size_t data_size, | 134 size_t data_size, |
| 135 const std::vector<char>& key_id, | 135 const std::vector<char>& key_id, |
| 136 const std::vector<char>& iv, | 136 const std::vector<char>& iv, |
| 137 const SubsampleEntry* subsamples, | 137 const SubsampleEntry* subsamples, |
| 138 int subsamples_size, | 138 int subsamples_size, |
| 139 const EncryptionScheme& encryption_scheme, |
| 139 base::TimeDelta presentation_time) { | 140 base::TimeDelta presentation_time) { |
| 140 if (data_size > | 141 if (data_size > |
| 141 base::checked_cast<size_t>(std::numeric_limits<int32_t>::max())) { | 142 base::checked_cast<size_t>(std::numeric_limits<int32_t>::max())) { |
| 142 return MEDIA_CODEC_ERROR; | 143 return MEDIA_CODEC_ERROR; |
| 143 } | 144 } |
| 144 if (key_id.size() > 16 || iv.size()) | 145 if (key_id.size() > 16 || iv.size()) |
| 145 return MEDIA_CODEC_ERROR; | 146 return MEDIA_CODEC_ERROR; |
| 146 if (data && !FillInputBuffer(index, data, data_size)) | 147 if (data && !FillInputBuffer(index, data, data_size)) |
| 147 return MEDIA_CODEC_ERROR; | 148 return MEDIA_CODEC_ERROR; |
| 149 if (encryption_scheme.mode() != EncryptionScheme::CIPHER_MODE_AES_CTR || |
| 150 encryption_scheme.pattern().IsInEffect()) |
| 151 return MEDIA_CODEC_ERROR; |
| 148 | 152 |
| 149 int new_subsamples_size = subsamples_size == 0 ? 1 : subsamples_size; | 153 int new_subsamples_size = subsamples_size == 0 ? 1 : subsamples_size; |
| 150 std::vector<size_t> clear_data, encrypted_data; | 154 std::vector<size_t> clear_data, encrypted_data; |
| 151 if (subsamples_size == 0) { | 155 if (subsamples_size == 0) { |
| 152 DCHECK(!subsamples); | 156 DCHECK(!subsamples); |
| 153 clear_data.push_back(0); | 157 clear_data.push_back(0); |
| 154 encrypted_data.push_back(data_size); | 158 encrypted_data.push_back(data_size); |
| 155 } else { | 159 } else { |
| 156 DCHECK_GT(subsamples_size, 0); | 160 DCHECK_GT(subsamples_size, 0); |
| 157 DCHECK(subsamples); | 161 DCHECK(subsamples); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 return MEDIA_CODEC_OK; | 253 return MEDIA_CODEC_OK; |
| 250 } | 254 } |
| 251 | 255 |
| 252 std::string NdkMediaCodecBridge::GetName() { | 256 std::string NdkMediaCodecBridge::GetName() { |
| 253 // The NDK api doesn't expose a getName like the Java one. | 257 // The NDK api doesn't expose a getName like the Java one. |
| 254 NOTIMPLEMENTED(); | 258 NOTIMPLEMENTED(); |
| 255 return ""; | 259 return ""; |
| 256 } | 260 } |
| 257 | 261 |
| 258 } // namespace media | 262 } // namespace media |
| OLD | NEW |