diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-29 18:32:48 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-29 18:32:48 +0000 |
commit | 62de8837965ca7ad93bdd72f4061b3243ab5731d (patch) | |
tree | cfcd4668cb9699a22ed370a8f1c9da61de13b402 /media | |
parent | 9488d4d8bfc8837dcbc414680a01594e2e75ba7d (diff) | |
download | chromium_src-62de8837965ca7ad93bdd72f4061b3243ab5731d.zip chromium_src-62de8837965ca7ad93bdd72f4061b3243ab5731d.tar.gz chromium_src-62de8837965ca7ad93bdd72f4061b3243ab5731d.tar.bz2 |
Fix race in Pipeline where video_decoder_ was accessed from multiple threads.
I moved the code that clears the variable to StopTask(). The problem was that
all access to this variable except for inside Stop(), happens on the Pipeline
thread, but was not protected by a lock. So, Stop() could be called and it
could cause random crashes on the pipeline thread such as in the case I
mention in the below bug.
BUG=115299
TEST=follow repro steps in the bug report.
Review URL: http://codereview.chromium.org/9536009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/base/pipeline.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc index 0bfebf7..2a7ca39 100644 --- a/media/base/pipeline.cc +++ b/media/base/pipeline.cc @@ -107,11 +107,6 @@ void Pipeline::Stop(const PipelineStatusCB& stop_callback) { base::AutoLock auto_lock(lock_); CHECK(running_) << "Media pipeline isn't running"; - if (video_decoder_) { - video_decoder_->PrepareForShutdownHack(); - video_decoder_ = NULL; - } - // Stop the pipeline, which will set |running_| to false on our behalf. message_loop_->PostTask(FROM_HERE, base::Bind( &Pipeline::StopTask, this, stop_callback)); @@ -757,6 +752,11 @@ void Pipeline::StopTask(const PipelineStatusCB& stop_callback) { DCHECK(!IsPipelineStopPending()); DCHECK_NE(state_, kStopped); + if (video_decoder_) { + video_decoder_->PrepareForShutdownHack(); + video_decoder_ = NULL; + } + if (state_ == kStopped) { // Already stopped so just run callback. stop_callback.Run(status_); |