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

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

Issue 215783002: Fix an issue that audio and video may run out of sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/audio_decoder_job.h" 5 #include "media/base/android/audio_decoder_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "media/base/android/media_codec_bridge.h" 10 #include "media/base/android/media_codec_bridge.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void AudioDecoderJob::SetVolume(double volume) { 56 void AudioDecoderJob::SetVolume(double volume) {
57 audio_codec_bridge_->SetVolume(volume); 57 audio_codec_bridge_->SetVolume(volume);
58 } 58 }
59 59
60 void AudioDecoderJob::ReleaseOutputBuffer( 60 void AudioDecoderJob::ReleaseOutputBuffer(
61 int output_buffer_index, 61 int output_buffer_index,
62 size_t size, 62 size_t size,
63 bool render_output, 63 bool render_output,
64 const ReleaseOutputCompletionCallback& callback) { 64 const ReleaseOutputCompletionCallback& callback) {
65 size_t size_to_render = render_output ? size : 0u; 65 size_t size_to_render = render_output ? size : 0u;
66 if (size_to_render) 66 base::TimeTicks current_time;
67 audio_codec_bridge_->PlayOutputBuffer(output_buffer_index, size_to_render); 67 int64 head_position = 0;
68 if (size_to_render) {
69 head_position = audio_codec_bridge_->PlayOutputBuffer(output_buffer_index,
70 size_to_render);
71 current_time = base::TimeTicks::Now();
72 }
73
68 audio_codec_bridge_->ReleaseOutputBuffer(output_buffer_index, false); 74 audio_codec_bridge_->ReleaseOutputBuffer(output_buffer_index, false);
69 75
70 callback.Run(size_to_render); 76 callback.Run(size_to_render, head_position, current_time);
71 } 77 }
72 78
73 bool AudioDecoderJob::ComputeTimeToRender() const { 79 bool AudioDecoderJob::ComputeTimeToRender() const {
74 return false; 80 return false;
75 } 81 }
76 82
77 } // namespace media 83 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698