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

Unified Diff: content/browser/renderer_host/media/video_capture_device_impl.cc

Issue 130253002: Attempt to fixed crash on stop mirroring by stopping render thread on a worker thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed miu's comments Created 6 years, 11 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
Index: content/browser/renderer_host/media/video_capture_device_impl.cc
diff --git a/content/browser/renderer_host/media/video_capture_device_impl.cc b/content/browser/renderer_host/media/video_capture_device_impl.cc
index f2eac243fb8b6b07d6a9071b5f063981d5f826aa..045eda6092d0608c640ccf57bb4d4b9489356617 100644
--- a/content/browser/renderer_host/media/video_capture_device_impl.cc
+++ b/content/browser/renderer_host/media/video_capture_device_impl.cc
@@ -34,10 +34,8 @@ namespace {
void DeleteCaptureMachineOnUIThread(
scoped_ptr<VideoCaptureMachine> capture_machine) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (capture_machine) {
- capture_machine->Stop();
- capture_machine.reset();
- }
+
+ capture_machine.reset();
}
} // namespace
@@ -247,7 +245,8 @@ void VideoCaptureDeviceImpl::StopAndDeAllocate() {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, base::Bind(
&VideoCaptureMachine::Stop,
- base::Unretained(capture_machine_.get())));
+ base::Unretained(capture_machine_.get()),
+ base::Bind(&base::DoNothing)));
}
void VideoCaptureDeviceImpl::CaptureStarted(bool success) {
@@ -267,9 +266,13 @@ VideoCaptureDeviceImpl::~VideoCaptureDeviceImpl() {
// If capture_machine is not NULL, then we need to return to the UI thread to
// safely stop the capture machine.
if (capture_machine_) {
+ VideoCaptureMachine* capture_machine_ptr = capture_machine_.get();
BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE, base::Bind(
- &DeleteCaptureMachineOnUIThread, base::Passed(&capture_machine_)));
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&VideoCaptureMachine::Stop,
+ base::Unretained(capture_machine_ptr),
+ base::Bind(&DeleteCaptureMachineOnUIThread,
+ base::Passed(&capture_machine_))));
}
DVLOG(1) << "VideoCaptureDeviceImpl@" << this << " destroying.";
}

Powered by Google App Engine
This is Rietveld 408576698