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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 return MEDIA_CODEC_ERROR; | 327 return MEDIA_CODEC_ERROR; |
328 const size_t total_capacity = env->GetDirectBufferCapacity(j_buffer.obj()); | 328 const size_t total_capacity = env->GetDirectBufferCapacity(j_buffer.obj()); |
329 CHECK_GE(total_capacity, offset); | 329 CHECK_GE(total_capacity, offset); |
330 *addr = reinterpret_cast<const uint8_t*>( | 330 *addr = reinterpret_cast<const uint8_t*>( |
331 env->GetDirectBufferAddress(j_buffer.obj())) + | 331 env->GetDirectBufferAddress(j_buffer.obj())) + |
332 offset; | 332 offset; |
333 *capacity = total_capacity - offset; | 333 *capacity = total_capacity - offset; |
334 return MEDIA_CODEC_OK; | 334 return MEDIA_CODEC_OK; |
335 } | 335 } |
336 | 336 |
337 bool SdkMediaCodecBridge::IsSoftwareCodec() { | |
338 JNIEnv* env = AttachCurrentThread(); | |
339 return Java_MediaCodecBridge_isSoftwareCodec(env, j_media_codec_.obj()); | |
340 } | |
341 | |
342 // static | 337 // static |
343 bool SdkMediaCodecBridge::RegisterSdkMediaCodecBridge(JNIEnv* env) { | 338 bool SdkMediaCodecBridge::RegisterSdkMediaCodecBridge(JNIEnv* env) { |
344 return RegisterNativesImpl(env); | 339 return RegisterNativesImpl(env); |
345 } | 340 } |
346 | 341 |
347 // static | 342 // static |
348 AudioCodecBridge* AudioCodecBridge::Create(const AudioCodec& codec) { | 343 AudioCodecBridge* AudioCodecBridge::Create(const AudioCodec& codec) { |
349 if (!MediaCodecUtil::IsMediaCodecAvailable()) | 344 if (!MediaCodecUtil::IsMediaCodecAvailable()) |
350 return nullptr; | 345 return nullptr; |
351 | 346 |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 if (adaptive_playback_supported_for_testing_ == 0) | 700 if (adaptive_playback_supported_for_testing_ == 0) |
706 return false; | 701 return false; |
707 else if (adaptive_playback_supported_for_testing_ > 0) | 702 else if (adaptive_playback_supported_for_testing_ > 0) |
708 return true; | 703 return true; |
709 JNIEnv* env = AttachCurrentThread(); | 704 JNIEnv* env = AttachCurrentThread(); |
710 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), | 705 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), |
711 width, height); | 706 width, height); |
712 } | 707 } |
713 | 708 |
714 } // namespace media | 709 } // namespace media |
OLD | NEW |