| 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 <utility> |
| 9 | 10 |
| 10 #include "base/android/build_info.h" | 11 #include "base/android/build_info.h" |
| 11 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
| 12 #include "base/android/jni_array.h" | 13 #include "base/android/jni_array.h" |
| 13 #include "base/android/jni_string.h" | 14 #include "base/android/jni_string.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/numerics/safe_conversions.h" | 16 #include "base/numerics/safe_conversions.h" |
| 16 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 17 #include "jni/MediaCodecBridge_jni.h" | 18 #include "jni/MediaCodecBridge_jni.h" |
| 18 #include "media/base/bit_reader.h" | 19 #include "media/base/bit_reader.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 static_cast<uint32_t>(std::numeric_limits<jint>::max())) { | 190 static_cast<uint32_t>(std::numeric_limits<jint>::max())) { |
| 190 return MEDIA_CODEC_ERROR; | 191 return MEDIA_CODEC_ERROR; |
| 191 } | 192 } |
| 192 | 193 |
| 193 native_clear_array[i] = subsamples[i].clear_bytes; | 194 native_clear_array[i] = subsamples[i].clear_bytes; |
| 194 native_cypher_array[i] = subsamples[i].cypher_bytes; | 195 native_cypher_array[i] = subsamples[i].cypher_bytes; |
| 195 } | 196 } |
| 196 } | 197 } |
| 197 | 198 |
| 198 ScopedJavaLocalRef<jintArray> clear_array = | 199 ScopedJavaLocalRef<jintArray> clear_array = |
| 199 ToJavaIntArray(env, native_clear_array.Pass(), new_subsamples_size); | 200 ToJavaIntArray(env, std::move(native_clear_array), new_subsamples_size); |
| 200 ScopedJavaLocalRef<jintArray> cypher_array = | 201 ScopedJavaLocalRef<jintArray> cypher_array = |
| 201 ToJavaIntArray(env, native_cypher_array.Pass(), new_subsamples_size); | 202 ToJavaIntArray(env, std::move(native_cypher_array), new_subsamples_size); |
| 202 | 203 |
| 203 return static_cast<MediaCodecStatus>( | 204 return static_cast<MediaCodecStatus>( |
| 204 Java_MediaCodecBridge_queueSecureInputBuffer( | 205 Java_MediaCodecBridge_queueSecureInputBuffer( |
| 205 env, j_media_codec_.obj(), index, 0, j_iv.obj(), j_key_id.obj(), | 206 env, j_media_codec_.obj(), index, 0, j_iv.obj(), j_key_id.obj(), |
| 206 clear_array.obj(), cypher_array.obj(), new_subsamples_size, | 207 clear_array.obj(), cypher_array.obj(), new_subsamples_size, |
| 207 presentation_time.InMicroseconds())); | 208 presentation_time.InMicroseconds())); |
| 208 } | 209 } |
| 209 | 210 |
| 210 void SdkMediaCodecBridge::QueueEOS(int input_buffer_index) { | 211 void SdkMediaCodecBridge::QueueEOS(int input_buffer_index) { |
| 211 DVLOG(3) << __PRETTY_FUNCTION__ << ": " << input_buffer_index; | 212 DVLOG(3) << __PRETTY_FUNCTION__ << ": " << input_buffer_index; |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 if (adaptive_playback_supported_for_testing_ == 0) | 634 if (adaptive_playback_supported_for_testing_ == 0) |
| 634 return false; | 635 return false; |
| 635 else if (adaptive_playback_supported_for_testing_ > 0) | 636 else if (adaptive_playback_supported_for_testing_ > 0) |
| 636 return true; | 637 return true; |
| 637 JNIEnv* env = AttachCurrentThread(); | 638 JNIEnv* env = AttachCurrentThread(); |
| 638 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), | 639 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), |
| 639 width, height); | 640 width, height); |
| 640 } | 641 } |
| 641 | 642 |
| 642 } // namespace media | 643 } // namespace media |
| OLD | NEW |