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

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

Issue 238053004: Revert of Fix an issue that audio and video may run out of sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « media/base/android/media_codec_bridge.h ('k') | media/base/android/media_decoder_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 break; 586 break;
587 } 587 }
588 default: 588 default:
589 LOG(ERROR) << "Invalid header encountered for codec: " 589 LOG(ERROR) << "Invalid header encountered for codec: "
590 << AudioCodecToAndroidMimeType(codec); 590 << AudioCodecToAndroidMimeType(codec);
591 return false; 591 return false;
592 } 592 }
593 return true; 593 return true;
594 } 594 }
595 595
596 int64 AudioCodecBridge::PlayOutputBuffer(int index, size_t size) { 596 void AudioCodecBridge::PlayOutputBuffer(int index, size_t size) {
597 DCHECK_LE(0, index); 597 DCHECK_LE(0, index);
598 int numBytes = base::checked_cast<int>(size); 598 int numBytes = base::checked_cast<int>(size);
599 JNIEnv* env = AttachCurrentThread(); 599 JNIEnv* env = AttachCurrentThread();
600 ScopedJavaLocalRef<jobject> buf = 600 ScopedJavaLocalRef<jobject> buf =
601 Java_MediaCodecBridge_getOutputBuffer(env, media_codec(), index); 601 Java_MediaCodecBridge_getOutputBuffer(env, media_codec(), index);
602 uint8* buffer = static_cast<uint8*>(env->GetDirectBufferAddress(buf.obj())); 602 uint8* buffer = static_cast<uint8*>(env->GetDirectBufferAddress(buf.obj()));
603 603
604 ScopedJavaLocalRef<jbyteArray> byte_array = 604 ScopedJavaLocalRef<jbyteArray> byte_array =
605 base::android::ToJavaByteArray(env, buffer, numBytes); 605 base::android::ToJavaByteArray(env, buffer, numBytes);
606 return Java_MediaCodecBridge_playOutputBuffer( 606 Java_MediaCodecBridge_playOutputBuffer(env, media_codec(), byte_array.obj());
607 env, media_codec(), byte_array.obj());
608 } 607 }
609 608
610 void AudioCodecBridge::SetVolume(double volume) { 609 void AudioCodecBridge::SetVolume(double volume) {
611 JNIEnv* env = AttachCurrentThread(); 610 JNIEnv* env = AttachCurrentThread();
612 Java_MediaCodecBridge_setVolume(env, media_codec(), volume); 611 Java_MediaCodecBridge_setVolume(env, media_codec(), volume);
613 } 612 }
614 613
615 // static 614 // static
616 AudioCodecBridge* AudioCodecBridge::Create(const AudioCodec& codec) { 615 AudioCodecBridge* AudioCodecBridge::Create(const AudioCodec& codec) {
617 if (!MediaCodecBridge::IsAvailable()) 616 if (!MediaCodecBridge::IsAvailable())
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 void VideoCodecBridge::RequestKeyFrameSoon() { 725 void VideoCodecBridge::RequestKeyFrameSoon() {
727 JNIEnv* env = AttachCurrentThread(); 726 JNIEnv* env = AttachCurrentThread();
728 Java_MediaCodecBridge_requestKeyFrameSoon(env, media_codec()); 727 Java_MediaCodecBridge_requestKeyFrameSoon(env, media_codec());
729 } 728 }
730 729
731 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { 730 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) {
732 return RegisterNativesImpl(env); 731 return RegisterNativesImpl(env);
733 } 732 }
734 733
735 } // namespace media 734 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_codec_bridge.h ('k') | media/base/android/media_decoder_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698