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

Unified Diff: remoting/host/video_scheduler.cc

Issue 11474043: Wait for encode thread during VideoScheduler teardown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | « remoting/host/video_scheduler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/video_scheduler.cc
diff --git a/remoting/host/video_scheduler.cc b/remoting/host/video_scheduler.cc
index 305caba19d9d197bffa923c14ad729c01fd857db..555a76b89d42a3a352f36e3ed7c7adc8f22eb7d0 100644
--- a/remoting/host/video_scheduler.cc
+++ b/remoting/host/video_scheduler.cc
@@ -159,9 +159,12 @@ void VideoScheduler::StopOnCaptureThread(const base::Closure& done_task) {
// |capture_timer_| must be destroyed on the thread on which it is used.
capture_timer_.reset();
- // Activity on the encode thread will stop implicitly as a result of
- // captures having stopped.
- network_task_runner_->PostTask(FROM_HERE, done_task);
+ // Ensure that the encode thread is no longer processing capture data,
+ // otherwise tearing down |capturer_| will crash it. See crbug.com/163641.
+ // TODO(wez): Make it safe to tear down capturer while buffers remain, and
+ // remove this work-around.
+ capture_task_runner_->PostTask(FROM_HERE,
+ base::Bind(&VideoScheduler::StopOnCaptureThread, this, done_task));
alexeypa (please no reviews) 2012/12/10 21:10:12 VideoScheduler::StopOnCaptureThread -> VideoSchedu
Wez 2012/12/10 22:33:51 *facepalm*
Wez 2012/12/10 22:33:51 Done.
}
void VideoScheduler::ScheduleNextCapture() {
@@ -285,4 +288,12 @@ void VideoScheduler::EncodedDataAvailableCallback(
base::Passed(&packet)));
}
+void VideoScheduler::StopOnEncodeThread(const base::Closure& done_task) {
+ DCHECK(encode_task_runner_->BelongsToCurrentThread());
+
+ // This is posted by StopOnCaptureThread, so we know that by the time we
+ // process it there are no more encode tasks queued.
+ network_task_runner_->PostTask(FROM_HERE, done_task);
+}
+
} // namespace remoting
« no previous file with comments | « remoting/host/video_scheduler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698