summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-02 22:54:37 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-02 22:54:37 +0000
commite0a4a97c380a34306ec2acbf7ce7d1bda3c684b7 (patch)
tree56c66012b2e0fda5102da444b907bf04b8f043f2
parent5fcd5b10402e4e32d7849aca0a57805fed72ec83 (diff)
downloadchromium_src-e0a4a97c380a34306ec2acbf7ce7d1bda3c684b7.zip
chromium_src-e0a4a97c380a34306ec2acbf7ce7d1bda3c684b7.tar.gz
chromium_src-e0a4a97c380a34306ec2acbf7ce7d1bda3c684b7.tar.bz2
Audio cut off ~500ms too early
BUG=23055 TEST=layout tests and audio won't cut off too early with this file: http://commons.wikimedia.org/wiki/File:Montreal2.ogg This patch fix the problem by adding an extra condition to determine the end of playback by using the information of buffered audio data in the browser process. If both the renderer process and browser process don't have any more audio data then end of playback is resulted. Review URL: http://codereview.chromium.org/1581008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43546 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/media/audio_renderer_impl.cc2
-rw-r--r--media/filters/audio_renderer_base.cc6
2 files changed, 5 insertions, 3 deletions
diff --git a/chrome/renderer/media/audio_renderer_impl.cc b/chrome/renderer/media/audio_renderer_impl.cc
index 70cf769..c39c4d5 100644
--- a/chrome/renderer/media/audio_renderer_impl.cc
+++ b/chrome/renderer/media/audio_renderer_impl.cc
@@ -195,7 +195,7 @@ void AudioRendererImpl::OnRequestPacket(uint32 bytes_in_buffer,
request_delay_ = ConvertToDuration(bytes_in_buffer);
}
- // Try to fill in the fulfill the packet request.
+ // Try to fulfill the packet request.
OnNotifyPacketReady();
}
diff --git a/media/filters/audio_renderer_base.cc b/media/filters/audio_renderer_base.cc
index 712fc45..f07a4c2 100644
--- a/media/filters/audio_renderer_base.cc
+++ b/media/filters/audio_renderer_base.cc
@@ -192,8 +192,10 @@ uint32 AudioRendererBase::FillBuffer(uint8* dest,
last_fill_buffer_time = last_fill_buffer_time_;
last_fill_buffer_time_ = base::TimeDelta();
- // Check if we finally reached end of stream by emptying |algorithm_|.
- if (algorithm_->IsQueueEmpty()) {
+ // Use two conditions to determine the end of playback:
+ // 1. Algorithm has no audio data.
+ // 2. Browser process has no audio data.
+ if (algorithm_->IsQueueEmpty() && !playback_delay.ToInternalValue()) {
if (recieved_end_of_stream_ && !rendered_end_of_stream_) {
rendered_end_of_stream_ = true;
host()->NotifyEnded();