diff options
Diffstat (limited to 'chrome/renderer/media/audio_renderer_impl.cc')
-rw-r--r-- | chrome/renderer/media/audio_renderer_impl.cc | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/chrome/renderer/media/audio_renderer_impl.cc b/chrome/renderer/media/audio_renderer_impl.cc index a1cae17..15a98a5 100644 --- a/chrome/renderer/media/audio_renderer_impl.cc +++ b/chrome/renderer/media/audio_renderer_impl.cc @@ -137,16 +137,36 @@ void AudioRendererImpl::SetPlaybackRate(float rate) { } } +void AudioRendererImpl::Pause(media::FilterCallback* callback) { + AudioRendererBase::Pause(callback); + AutoLock auto_lock(lock_); + if (stopped_) + return; + + io_loop_->PostTask(FROM_HERE, + NewRunnableMethod(this, &AudioRendererImpl::PauseTask)); +} + void AudioRendererImpl::Seek(base::TimeDelta time, media::FilterCallback* callback) { AudioRendererBase::Seek(time, callback); + AutoLock auto_lock(lock_); + if (stopped_) + return; + io_loop_->PostTask(FROM_HERE, + NewRunnableMethod(this, &AudioRendererImpl::SeekTask)); +} + + +void AudioRendererImpl::Play(media::FilterCallback* callback) { + AudioRendererBase::Play(callback); AutoLock auto_lock(lock_); if (stopped_) return; io_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, &AudioRendererImpl::SeekTask)); + NewRunnableMethod(this, &AudioRendererImpl::PlayTask)); } void AudioRendererImpl::SetVolume(float volume) { @@ -268,6 +288,8 @@ void AudioRendererImpl::PauseTask() { void AudioRendererImpl::SeekTask() { DCHECK(MessageLoop::current() == io_loop_); + // We have to pause the audio stream before we can flush. + filter_->Send(new ViewHostMsg_PauseAudioStream(0, stream_id_)); filter_->Send(new ViewHostMsg_FlushAudioStream(0, stream_id_)); } |