| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // static | 337 // static |
| 338 bool SdkMediaCodecBridge::RegisterSdkMediaCodecBridge(JNIEnv* env) { | |
| 339 return RegisterNativesImpl(env); | |
| 340 } | |
| 341 | |
| 342 // static | |
| 343 AudioCodecBridge* AudioCodecBridge::Create(const AudioCodec& codec) { | 338 AudioCodecBridge* AudioCodecBridge::Create(const AudioCodec& codec) { |
| 344 if (!MediaCodecUtil::IsMediaCodecAvailable()) | 339 if (!MediaCodecUtil::IsMediaCodecAvailable()) |
| 345 return nullptr; | 340 return nullptr; |
| 346 | 341 |
| 347 const std::string mime = AudioCodecToAndroidMimeType(codec); | 342 const std::string mime = AudioCodecToAndroidMimeType(codec); |
| 348 if (mime.empty()) | 343 if (mime.empty()) |
| 349 return nullptr; | 344 return nullptr; |
| 350 | 345 |
| 351 std::unique_ptr<AudioCodecBridge> bridge(new AudioCodecBridge(mime)); | 346 std::unique_ptr<AudioCodecBridge> bridge(new AudioCodecBridge(mime)); |
| 352 if (!bridge->media_codec()) | 347 if (!bridge->media_codec()) |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 if (adaptive_playback_supported_for_testing_ == 0) | 695 if (adaptive_playback_supported_for_testing_ == 0) |
| 701 return false; | 696 return false; |
| 702 else if (adaptive_playback_supported_for_testing_ > 0) | 697 else if (adaptive_playback_supported_for_testing_ > 0) |
| 703 return true; | 698 return true; |
| 704 JNIEnv* env = AttachCurrentThread(); | 699 JNIEnv* env = AttachCurrentThread(); |
| 705 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), | 700 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), |
| 706 width, height); | 701 width, height); |
| 707 } | 702 } |
| 708 | 703 |
| 709 } // namespace media | 704 } // namespace media |
| OLD | NEW |