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

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 435023002: Revert "Revert 285479 "Make DataSource::Stop() synchronous."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « media/filters/ffmpeg_demuxer.h ('k') | media/filters/file_data_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index a2264dcc8ef895686f4fdd80c941d53ec357a477..c89c34dca4fd0afc49504ff00029c3a1b94906ff 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -530,11 +530,22 @@ FFmpegDemuxer::~FFmpegDemuxer() {}
void FFmpegDemuxer::Stop(const base::Closure& callback) {
DCHECK(task_runner_->BelongsToCurrentThread());
url_protocol_->Abort();
- data_source_->Stop(
- BindToCurrentLoop(base::Bind(&FFmpegDemuxer::OnDataSourceStopped,
- weak_factory_.GetWeakPtr(),
- BindToCurrentLoop(callback))));
+ data_source_->Stop();
+
+ // This will block until all tasks complete. Note that after this returns it's
+ // possible for reply tasks (e.g., OnReadFrameDone()) to be queued on this
+ // thread. Each of the reply task methods must check whether we've stopped the
+ // thread and drop their results on the floor.
+ blocking_thread_.Stop();
+
+ StreamVector::iterator iter;
+ for (iter = streams_.begin(); iter != streams_.end(); ++iter) {
+ if (*iter)
+ (*iter)->Stop();
+ }
+
data_source_ = NULL;
+ task_runner_->PostTask(FROM_HERE, callback);
}
void FFmpegDemuxer::Seek(base::TimeDelta time, const PipelineStatusCB& cb) {
@@ -1120,23 +1131,6 @@ void FFmpegDemuxer::OnReadFrameDone(ScopedAVPacket packet, int result) {
ReadFrameIfNeeded();
}
-void FFmpegDemuxer::OnDataSourceStopped(const base::Closure& callback) {
- // This will block until all tasks complete. Note that after this returns it's
- // possible for reply tasks (e.g., OnReadFrameDone()) to be queued on this
- // thread. Each of the reply task methods must check whether we've stopped the
- // thread and drop their results on the floor.
- DCHECK(task_runner_->BelongsToCurrentThread());
- blocking_thread_.Stop();
-
- StreamVector::iterator iter;
- for (iter = streams_.begin(); iter != streams_.end(); ++iter) {
- if (*iter)
- (*iter)->Stop();
- }
-
- callback.Run();
-}
-
bool FFmpegDemuxer::StreamsHaveAvailableCapacity() {
DCHECK(task_runner_->BelongsToCurrentThread());
StreamVector::iterator iter;
« no previous file with comments | « media/filters/ffmpeg_demuxer.h ('k') | media/filters/file_data_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698