| 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 #include <utility> |
| 10 | 10 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 void SdkMediaCodecBridge::ReleaseOutputBuffer(int index, bool render) { | 268 void SdkMediaCodecBridge::ReleaseOutputBuffer(int index, bool render) { |
| 269 DVLOG(3) << __PRETTY_FUNCTION__ << ": " << index; | 269 DVLOG(3) << __PRETTY_FUNCTION__ << ": " << index; |
| 270 JNIEnv* env = AttachCurrentThread(); | 270 JNIEnv* env = AttachCurrentThread(); |
| 271 CHECK(env); | 271 CHECK(env); |
| 272 | 272 |
| 273 Java_MediaCodecBridge_releaseOutputBuffer(env, j_media_codec_.obj(), index, | 273 Java_MediaCodecBridge_releaseOutputBuffer(env, j_media_codec_.obj(), index, |
| 274 render); | 274 render); |
| 275 } | 275 } |
| 276 | 276 |
| 277 int SdkMediaCodecBridge::GetOutputBuffersCount() { | |
| 278 JNIEnv* env = AttachCurrentThread(); | |
| 279 return Java_MediaCodecBridge_getOutputBuffersCount(env, j_media_codec_.obj()); | |
| 280 } | |
| 281 | |
| 282 size_t SdkMediaCodecBridge::GetOutputBuffersCapacity() { | |
| 283 JNIEnv* env = AttachCurrentThread(); | |
| 284 return Java_MediaCodecBridge_getOutputBuffersCapacity(env, | |
| 285 j_media_codec_.obj()); | |
| 286 } | |
| 287 | |
| 288 void SdkMediaCodecBridge::GetInputBuffer(int input_buffer_index, | 277 void SdkMediaCodecBridge::GetInputBuffer(int input_buffer_index, |
| 289 uint8_t** data, | 278 uint8_t** data, |
| 290 size_t* capacity) { | 279 size_t* capacity) { |
| 291 JNIEnv* env = AttachCurrentThread(); | 280 JNIEnv* env = AttachCurrentThread(); |
| 292 ScopedJavaLocalRef<jobject> j_buffer(Java_MediaCodecBridge_getInputBuffer( | 281 ScopedJavaLocalRef<jobject> j_buffer(Java_MediaCodecBridge_getInputBuffer( |
| 293 env, j_media_codec_.obj(), input_buffer_index)); | 282 env, j_media_codec_.obj(), input_buffer_index)); |
| 294 *data = static_cast<uint8_t*>(env->GetDirectBufferAddress(j_buffer.obj())); | 283 *data = static_cast<uint8_t*>(env->GetDirectBufferAddress(j_buffer.obj())); |
| 295 *capacity = | 284 *capacity = |
| 296 base::checked_cast<size_t>(env->GetDirectBufferCapacity(j_buffer.obj())); | 285 base::checked_cast<size_t>(env->GetDirectBufferCapacity(j_buffer.obj())); |
| 297 } | 286 } |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 if (adaptive_playback_supported_for_testing_ == 0) | 623 if (adaptive_playback_supported_for_testing_ == 0) |
| 635 return false; | 624 return false; |
| 636 else if (adaptive_playback_supported_for_testing_ > 0) | 625 else if (adaptive_playback_supported_for_testing_ > 0) |
| 637 return true; | 626 return true; |
| 638 JNIEnv* env = AttachCurrentThread(); | 627 JNIEnv* env = AttachCurrentThread(); |
| 639 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), | 628 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), |
| 640 width, height); | 629 width, height); |
| 641 } | 630 } |
| 642 | 631 |
| 643 } // namespace media | 632 } // namespace media |
| OLD | NEW |