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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 std::string SdkMediaCodecBridge::GetName() { | 337 std::string SdkMediaCodecBridge::GetName() { |
338 if (base::android::BuildInfo::GetInstance()->sdk_int() < 18) | 338 if (base::android::BuildInfo::GetInstance()->sdk_int() < 18) |
339 return ""; | 339 return ""; |
340 JNIEnv* env = AttachCurrentThread(); | 340 JNIEnv* env = AttachCurrentThread(); |
341 ScopedJavaLocalRef<jstring> j_name = | 341 ScopedJavaLocalRef<jstring> j_name = |
342 Java_MediaCodecBridge_getName(env, j_media_codec_.obj()); | 342 Java_MediaCodecBridge_getName(env, j_media_codec_.obj()); |
343 return ConvertJavaStringToUTF8(env, j_name.obj()); | 343 return ConvertJavaStringToUTF8(env, j_name.obj()); |
344 } | 344 } |
345 | 345 |
346 // static | 346 // static |
347 bool SdkMediaCodecBridge::RegisterSdkMediaCodecBridge(JNIEnv* env) { | |
348 return RegisterNativesImpl(env); | |
349 } | |
350 | |
351 // static | |
352 AudioCodecBridge* AudioCodecBridge::Create(const AudioCodec& codec) { | 347 AudioCodecBridge* AudioCodecBridge::Create(const AudioCodec& codec) { |
353 if (!MediaCodecUtil::IsMediaCodecAvailable()) | 348 if (!MediaCodecUtil::IsMediaCodecAvailable()) |
354 return nullptr; | 349 return nullptr; |
355 | 350 |
356 const std::string mime = AudioCodecToAndroidMimeType(codec); | 351 const std::string mime = AudioCodecToAndroidMimeType(codec); |
357 if (mime.empty()) | 352 if (mime.empty()) |
358 return nullptr; | 353 return nullptr; |
359 | 354 |
360 std::unique_ptr<AudioCodecBridge> bridge(new AudioCodecBridge(mime)); | 355 std::unique_ptr<AudioCodecBridge> bridge(new AudioCodecBridge(mime)); |
361 if (!bridge->media_codec()) | 356 if (!bridge->media_codec()) |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 if (adaptive_playback_supported_for_testing_ == 0) | 704 if (adaptive_playback_supported_for_testing_ == 0) |
710 return false; | 705 return false; |
711 else if (adaptive_playback_supported_for_testing_ > 0) | 706 else if (adaptive_playback_supported_for_testing_ > 0) |
712 return true; | 707 return true; |
713 JNIEnv* env = AttachCurrentThread(); | 708 JNIEnv* env = AttachCurrentThread(); |
714 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), | 709 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), |
715 width, height); | 710 width, height); |
716 } | 711 } |
717 | 712 |
718 } // namespace media | 713 } // namespace media |
OLD | NEW |