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

Unified Diff: media/filters/audio_renderer_impl.cc

Issue 363093003: Always run AudioRendererImpl's flush callback asynchronously. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | tools/valgrind/gtest_exclude/media_unittests.gtest_mac.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_renderer_impl.cc
diff --git a/media/filters/audio_renderer_impl.cc b/media/filters/audio_renderer_impl.cc
index 1b64c73c434a91c6914f5913d0fa3069f766dcad..0af11e4ef109667b96dfec85ade64d2525ca845b 100644
--- a/media/filters/audio_renderer_impl.cc
+++ b/media/filters/audio_renderer_impl.cc
@@ -185,7 +185,10 @@ void AudioRendererImpl::ResetDecoderDone() {
buffer_converter_->Reset();
algorithm_->FlushBuffers();
}
- base::ResetAndReturn(&flush_cb_).Run();
+
+ // Changes in buffering state are always posted. Flush callback must only be
+ // run after buffering state has been set back to nothing.
+ task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&flush_cb_));
}
void AudioRendererImpl::Stop(const base::Closure& callback) {
@@ -257,8 +260,7 @@ void AudioRendererImpl::Initialize(DemuxerStream* stream,
init_cb_ = init_cb;
time_cb_ = time_cb;
- // Callback can be run from audio callback thread in Render().
- buffering_state_cb_ = BindToCurrentLoop(buffering_state_cb);
+ buffering_state_cb_ = buffering_state_cb;
ended_cb_ = ended_cb;
error_cb_ = error_cb;
@@ -728,7 +730,9 @@ void AudioRendererImpl::SetBufferingState_Locked(
DCHECK_NE(buffering_state_, buffering_state);
lock_.AssertAcquired();
buffering_state_ = buffering_state;
- buffering_state_cb_.Run(buffering_state_);
+
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(buffering_state_cb_, buffering_state_));
}
} // namespace media
« no previous file with comments | « no previous file | tools/valgrind/gtest_exclude/media_unittests.gtest_mac.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698