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

Unified Diff: media/base/android/audio_decoder_job.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 side-by-side diff with in-line comments
Download patch
Index: media/base/android/audio_decoder_job.cc
diff --git a/media/base/android/audio_decoder_job.cc b/media/base/android/audio_decoder_job.cc
index 580c63f13af6994576000f4f9cfe0a1b32241c4b..d089796ccc65cc1de197aa75b2b1f25a58b7ca7e 100644
--- a/media/base/android/audio_decoder_job.cc
+++ b/media/base/android/audio_decoder_job.cc
@@ -8,14 +8,6 @@
#include "base/lazy_instance.h"
#include "base/threading/thread.h"
#include "media/base/android/media_codec_bridge.h"
-#include "media/base/audio_timestamp_helper.h"
-
-namespace {
-
-// Use 16bit PCM for audio output. Keep this value in sync with the output
-// format we passed to AudioTrack in MediaCodecBridge.
-const int kBytesPerAudioOutputSample = 2;
-}
namespace media {
@@ -43,26 +35,19 @@
scoped_ptr<AudioCodecBridge> codec(AudioCodecBridge::Create(audio_codec));
if (codec && codec->Start(audio_codec, sample_rate, channel_count, extra_data,
extra_data_size, true, media_crypto)) {
- scoped_ptr<AudioTimestampHelper> audio_timestamp_helper(
- new AudioTimestampHelper(sample_rate));
- return new AudioDecoderJob(
- audio_timestamp_helper.Pass(), codec.Pass(),
- kBytesPerAudioOutputSample * channel_count, request_data_cb);
+ return new AudioDecoderJob(codec.Pass(), request_data_cb);
}
+
LOG(ERROR) << "Failed to create AudioDecoderJob.";
return NULL;
}
AudioDecoderJob::AudioDecoderJob(
- scoped_ptr<AudioTimestampHelper> audio_timestamp_helper,
scoped_ptr<AudioCodecBridge> audio_codec_bridge,
- int bytes_per_frame,
const base::Closure& request_data_cb)
: MediaDecoderJob(g_audio_decoder_thread.Pointer()->message_loop_proxy(),
audio_codec_bridge.get(), request_data_cb),
- bytes_per_frame_(bytes_per_frame),
- audio_codec_bridge_(audio_codec_bridge.Pass()),
- audio_timestamp_helper_(audio_timestamp_helper.Pass()) {
+ audio_codec_bridge_(audio_codec_bridge.Pass()) {
}
AudioDecoderJob::~AudioDecoderJob() {
@@ -72,33 +57,17 @@
audio_codec_bridge_->SetVolume(volume);
}
-void AudioDecoderJob::SetBaseTimestamp(base::TimeDelta base_timestamp) {
- audio_timestamp_helper_->SetBaseTimestamp(base_timestamp);
-}
-
void AudioDecoderJob::ReleaseOutputBuffer(
int output_buffer_index,
size_t size,
bool render_output,
- base::TimeDelta current_presentation_timestamp,
const ReleaseOutputCompletionCallback& callback) {
- render_output = render_output && (size != 0u);
- if (render_output) {
- int64 head_position = audio_codec_bridge_->PlayOutputBuffer(
- output_buffer_index, size);
- audio_timestamp_helper_->AddFrames(size / (bytes_per_frame_));
- int64 frames_to_play =
- audio_timestamp_helper_->frame_count() - head_position;
- DCHECK_GE(frames_to_play, 0);
- current_presentation_timestamp =
- audio_timestamp_helper_->GetTimestamp() -
- audio_timestamp_helper_->GetFrameDuration(frames_to_play);
- } else {
- current_presentation_timestamp = kNoTimestamp();
- }
+ size_t size_to_render = render_output ? size : 0u;
+ if (size_to_render)
+ audio_codec_bridge_->PlayOutputBuffer(output_buffer_index, size_to_render);
audio_codec_bridge_->ReleaseOutputBuffer(output_buffer_index, false);
- callback.Run(current_presentation_timestamp,
- audio_timestamp_helper_->GetTimestamp());
+
+ callback.Run(size_to_render);
}
bool AudioDecoderJob::ComputeTimeToRender() const {
« no previous file with comments | « media/base/android/audio_decoder_job.h ('k') | media/base/android/java/src/org/chromium/media/MediaCodecBridge.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698