Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: media/base/android/media_codec_bridge.cc

Issue 669623004: Switch to Lollipop APIs for MediaCodec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove getInputBufferCount() call Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/media_codec_bridge.h" 5 #include "media/base/android/media_codec_bridge.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 #include <string> 8 #include <string>
9 9
10 #include "base/android/build_info.h" 10 #include "base/android/build_info.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 MediaCodecBridge::~MediaCodecBridge() { 238 MediaCodecBridge::~MediaCodecBridge() {
239 JNIEnv* env = AttachCurrentThread(); 239 JNIEnv* env = AttachCurrentThread();
240 CHECK(env); 240 CHECK(env);
241 if (j_media_codec_.obj()) 241 if (j_media_codec_.obj())
242 Java_MediaCodecBridge_release(env, j_media_codec_.obj()); 242 Java_MediaCodecBridge_release(env, j_media_codec_.obj());
243 } 243 }
244 244
245 bool MediaCodecBridge::StartInternal() { 245 bool MediaCodecBridge::StartInternal() {
246 JNIEnv* env = AttachCurrentThread(); 246 JNIEnv* env = AttachCurrentThread();
247 return Java_MediaCodecBridge_start(env, j_media_codec_.obj()) && 247 return Java_MediaCodecBridge_start(env, j_media_codec_.obj());
248 GetOutputBuffers();
249 } 248 }
250 249
251 MediaCodecStatus MediaCodecBridge::Reset() { 250 MediaCodecStatus MediaCodecBridge::Reset() {
252 JNIEnv* env = AttachCurrentThread(); 251 JNIEnv* env = AttachCurrentThread();
253 return static_cast<MediaCodecStatus>( 252 return static_cast<MediaCodecStatus>(
254 Java_MediaCodecBridge_flush(env, j_media_codec_.obj())); 253 Java_MediaCodecBridge_flush(env, j_media_codec_.obj()));
255 } 254 }
256 255
257 void MediaCodecBridge::Stop() { 256 void MediaCodecBridge::Stop() {
258 JNIEnv* env = AttachCurrentThread(); 257 JNIEnv* env = AttachCurrentThread();
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 419
421 void MediaCodecBridge::ReleaseOutputBuffer(int index, bool render) { 420 void MediaCodecBridge::ReleaseOutputBuffer(int index, bool render) {
422 DVLOG(3) << __PRETTY_FUNCTION__ << ": " << index; 421 DVLOG(3) << __PRETTY_FUNCTION__ << ": " << index;
423 JNIEnv* env = AttachCurrentThread(); 422 JNIEnv* env = AttachCurrentThread();
424 CHECK(env); 423 CHECK(env);
425 424
426 Java_MediaCodecBridge_releaseOutputBuffer( 425 Java_MediaCodecBridge_releaseOutputBuffer(
427 env, j_media_codec_.obj(), index, render); 426 env, j_media_codec_.obj(), index, render);
428 } 427 }
429 428
430 int MediaCodecBridge::GetInputBuffersCount() {
431 JNIEnv* env = AttachCurrentThread();
432 return Java_MediaCodecBridge_getInputBuffersCount(env, j_media_codec_.obj());
433 }
434
435 int MediaCodecBridge::GetOutputBuffersCount() { 429 int MediaCodecBridge::GetOutputBuffersCount() {
436 JNIEnv* env = AttachCurrentThread(); 430 JNIEnv* env = AttachCurrentThread();
437 return Java_MediaCodecBridge_getOutputBuffersCount(env, j_media_codec_.obj()); 431 return Java_MediaCodecBridge_getOutputBuffersCount(env, j_media_codec_.obj());
438 } 432 }
439 433
440 size_t MediaCodecBridge::GetOutputBuffersCapacity() { 434 size_t MediaCodecBridge::GetOutputBuffersCapacity() {
441 JNIEnv* env = AttachCurrentThread(); 435 JNIEnv* env = AttachCurrentThread();
442 return Java_MediaCodecBridge_getOutputBuffersCapacity(env, 436 return Java_MediaCodecBridge_getOutputBuffersCapacity(env,
443 j_media_codec_.obj()); 437 j_media_codec_.obj());
444 } 438 }
445 439
446 bool MediaCodecBridge::GetOutputBuffers() {
447 JNIEnv* env = AttachCurrentThread();
448 return Java_MediaCodecBridge_getOutputBuffers(env, j_media_codec_.obj());
449 }
450
451 void MediaCodecBridge::GetInputBuffer(int input_buffer_index, 440 void MediaCodecBridge::GetInputBuffer(int input_buffer_index,
452 uint8** data, 441 uint8** data,
453 size_t* capacity) { 442 size_t* capacity) {
454 JNIEnv* env = AttachCurrentThread(); 443 JNIEnv* env = AttachCurrentThread();
455 ScopedJavaLocalRef<jobject> j_buffer(Java_MediaCodecBridge_getInputBuffer( 444 ScopedJavaLocalRef<jobject> j_buffer(Java_MediaCodecBridge_getInputBuffer(
456 env, j_media_codec_.obj(), input_buffer_index)); 445 env, j_media_codec_.obj(), input_buffer_index));
457 *data = static_cast<uint8*>(env->GetDirectBufferAddress(j_buffer.obj())); 446 *data = static_cast<uint8*>(env->GetDirectBufferAddress(j_buffer.obj()));
458 *capacity = base::checked_cast<size_t>( 447 *capacity = base::checked_cast<size_t>(
459 env->GetDirectBufferCapacity(j_buffer.obj())); 448 env->GetDirectBufferCapacity(j_buffer.obj()));
460 } 449 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 JNIEnv* env = AttachCurrentThread(); 768 JNIEnv* env = AttachCurrentThread();
780 return Java_MediaCodecBridge_isAdaptivePlaybackSupported( 769 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(
781 env, media_codec(), width, height); 770 env, media_codec(), width, height);
782 } 771 }
783 772
784 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { 773 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) {
785 return RegisterNativesImpl(env); 774 return RegisterNativesImpl(env);
786 } 775 }
787 776
788 } // namespace media 777 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698