Chromium Code Reviews| 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 base::TimeDelta presentation_time) { | 182 base::TimeDelta presentation_time) { |
| 182 DVLOG(3) << __FUNCTION__ << index << ": " << data_size; | 183 DVLOG(3) << __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, cypher_array, new_subsamples_size, | 233 clear_array, cypher_array, 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()), | |
|
xhwang
2016/10/20 23:52:07
To be safe, does it make sense to use saturated_ca
dougsteed
2016/10/21 17:15:05
saturated_cast doesn't work for enum, so I'd have
| |
| 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) << __FUNCTION__ << ": " << input_buffer_index; | 241 DVLOG(3) << __FUNCTION__ << ": " << input_buffer_index; |
| 238 JNIEnv* env = AttachCurrentThread(); | 242 JNIEnv* env = AttachCurrentThread(); |
| 239 Java_MediaCodecBridge_queueInputBuffer( | 243 Java_MediaCodecBridge_queueInputBuffer( |
| 240 env, j_media_codec_, input_buffer_index, 0, 0, 0, kBufferFlagEndOfStream); | 244 env, j_media_codec_, input_buffer_index, 0, 0, 0, kBufferFlagEndOfStream); |
| 241 } | 245 } |
| 242 | 246 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 666 if (adaptive_playback_supported_for_testing_ == 0) | 670 if (adaptive_playback_supported_for_testing_ == 0) |
| 667 return false; | 671 return false; |
| 668 else if (adaptive_playback_supported_for_testing_ > 0) | 672 else if (adaptive_playback_supported_for_testing_ > 0) |
| 669 return true; | 673 return true; |
| 670 JNIEnv* env = AttachCurrentThread(); | 674 JNIEnv* env = AttachCurrentThread(); |
| 671 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), | 675 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), |
| 672 width, height); | 676 width, height); |
| 673 } | 677 } |
| 674 | 678 |
| 675 } // namespace media | 679 } // namespace media |
| OLD | NEW |