OLD | NEW |
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/sdk_media_codec_bridge.h" | 5 #include "media/base/android/sdk_media_codec_bridge.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // TODO(timav): Combine this and above methods together keeping only the first | 171 // TODO(timav): Combine this and above methods together keeping only the first |
172 // interface after we switch to Spitzer pipeline. | 172 // interface after we switch to Spitzer pipeline. |
173 MediaCodecStatus SdkMediaCodecBridge::QueueSecureInputBuffer( | 173 MediaCodecStatus SdkMediaCodecBridge::QueueSecureInputBuffer( |
174 int index, | 174 int index, |
175 const uint8_t* data, | 175 const uint8_t* data, |
176 size_t data_size, | 176 size_t data_size, |
177 const std::vector<char>& key_id, | 177 const std::vector<char>& key_id, |
178 const std::vector<char>& iv, | 178 const std::vector<char>& iv, |
179 const SubsampleEntry* subsamples, | 179 const SubsampleEntry* subsamples, |
180 int subsamples_size, | 180 int subsamples_size, |
| 181 const EncryptionScheme& encryption_scheme, |
181 const base::TimeDelta& presentation_time) { | 182 const base::TimeDelta& presentation_time) { |
182 DVLOG(3) << __PRETTY_FUNCTION__ << index << ": " << data_size; | 183 DVLOG(3) << __PRETTY_FUNCTION__ << index << ": " << data_size; |
183 if (data_size > | 184 if (data_size > |
184 base::checked_cast<size_t>(std::numeric_limits<int32_t>::max())) { | 185 base::checked_cast<size_t>(std::numeric_limits<int32_t>::max())) { |
185 return MEDIA_CODEC_ERROR; | 186 return MEDIA_CODEC_ERROR; |
186 } | 187 } |
187 if (data && !FillInputBuffer(index, data, data_size)) | 188 if (data && !FillInputBuffer(index, data, data_size)) |
188 return MEDIA_CODEC_ERROR; | 189 return MEDIA_CODEC_ERROR; |
189 | 190 |
190 JNIEnv* env = AttachCurrentThread(); | 191 JNIEnv* env = AttachCurrentThread(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 224 |
224 ScopedJavaLocalRef<jintArray> clear_array = | 225 ScopedJavaLocalRef<jintArray> clear_array = |
225 ToJavaIntArray(env, std::move(native_clear_array), new_subsamples_size); | 226 ToJavaIntArray(env, std::move(native_clear_array), new_subsamples_size); |
226 ScopedJavaLocalRef<jintArray> cypher_array = | 227 ScopedJavaLocalRef<jintArray> cypher_array = |
227 ToJavaIntArray(env, std::move(native_cypher_array), new_subsamples_size); | 228 ToJavaIntArray(env, std::move(native_cypher_array), new_subsamples_size); |
228 | 229 |
229 return static_cast<MediaCodecStatus>( | 230 return static_cast<MediaCodecStatus>( |
230 Java_MediaCodecBridge_queueSecureInputBuffer( | 231 Java_MediaCodecBridge_queueSecureInputBuffer( |
231 env, j_media_codec_.obj(), index, 0, j_iv.obj(), j_key_id.obj(), | 232 env, j_media_codec_.obj(), index, 0, j_iv.obj(), j_key_id.obj(), |
232 clear_array.obj(), cypher_array.obj(), new_subsamples_size, | 233 clear_array.obj(), cypher_array.obj(), new_subsamples_size, |
| 234 static_cast<int>(encryption_scheme.mode()), |
| 235 static_cast<int>(encryption_scheme.pattern().encrypt_blocks()), |
| 236 static_cast<int>(encryption_scheme.pattern().skip_blocks()), |
233 presentation_time.InMicroseconds())); | 237 presentation_time.InMicroseconds())); |
234 } | 238 } |
235 | 239 |
236 void SdkMediaCodecBridge::QueueEOS(int input_buffer_index) { | 240 void SdkMediaCodecBridge::QueueEOS(int input_buffer_index) { |
237 DVLOG(3) << __PRETTY_FUNCTION__ << ": " << input_buffer_index; | 241 DVLOG(3) << __PRETTY_FUNCTION__ << ": " << input_buffer_index; |
238 JNIEnv* env = AttachCurrentThread(); | 242 JNIEnv* env = AttachCurrentThread(); |
239 Java_MediaCodecBridge_queueInputBuffer(env, j_media_codec_.obj(), | 243 Java_MediaCodecBridge_queueInputBuffer(env, j_media_codec_.obj(), |
240 input_buffer_index, 0, 0, 0, | 244 input_buffer_index, 0, 0, 0, |
241 kBufferFlagEndOfStream); | 245 kBufferFlagEndOfStream); |
242 } | 246 } |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 if (adaptive_playback_supported_for_testing_ == 0) | 702 if (adaptive_playback_supported_for_testing_ == 0) |
699 return false; | 703 return false; |
700 else if (adaptive_playback_supported_for_testing_ > 0) | 704 else if (adaptive_playback_supported_for_testing_ > 0) |
701 return true; | 705 return true; |
702 JNIEnv* env = AttachCurrentThread(); | 706 JNIEnv* env = AttachCurrentThread(); |
703 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), | 707 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), |
704 width, height); | 708 width, height); |
705 } | 709 } |
706 | 710 |
707 } // namespace media | 711 } // namespace media |
OLD | NEW |