Skip to content
Snippets Groups Projects
Commit cb4e1a83 authored by Gian-Carlo Pascutto's avatar Gian-Carlo Pascutto
Browse files

Bug 1228788 - Force QT device release to happen on the main thread. r=jesup

parent 2e171e6a
No related branches found
No related tags found
No related merge requests found
...@@ -186,6 +186,7 @@ CamerasParent::DispatchToVideoCaptureThread(nsRunnable *event) ...@@ -186,6 +186,7 @@ CamerasParent::DispatchToVideoCaptureThread(nsRunnable *event)
void void
CamerasParent::StopVideoCapture() CamerasParent::StopVideoCapture()
{ {
LOG((__PRETTY_FUNCTION__));
// We are called from the main thread (xpcom-shutdown) or // We are called from the main thread (xpcom-shutdown) or
// from PBackground (when the Actor shuts down). // from PBackground (when the Actor shuts down).
// Shut down the WebRTC stack (on the capture thread) // Shut down the WebRTC stack (on the capture thread)
...@@ -407,6 +408,7 @@ CamerasParent::SetupEngine(CaptureEngine aCapEngine) ...@@ -407,6 +408,7 @@ CamerasParent::SetupEngine(CaptureEngine aCapEngine)
void void
CamerasParent::CloseEngines() CamerasParent::CloseEngines()
{ {
LOG((__PRETTY_FUNCTION__));
if (!mWebRTCAlive) { if (!mWebRTCAlive) {
return; return;
} }
...@@ -700,10 +702,12 @@ CamerasParent::RecvReleaseCaptureDevice(const int& aCapEngine, ...@@ -700,10 +702,12 @@ CamerasParent::RecvReleaseCaptureDevice(const int& aCapEngine,
RefPtr<nsIRunnable> ipc_runnable = RefPtr<nsIRunnable> ipc_runnable =
media::NewRunnableFrom([self, error, numdev]() -> nsresult { media::NewRunnableFrom([self, error, numdev]() -> nsresult {
if (self->IsShuttingDown()) { if (self->IsShuttingDown()) {
LOG(("In Shutdown, not Releasing"));
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
if (error) { if (error) {
Unused << self->SendReplyFailure(); Unused << self->SendReplyFailure();
LOG(("Failed to free device nr %d", numdev));
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} else { } else {
Unused << self->SendReplySuccess(); Unused << self->SendReplySuccess();
......
...@@ -61,8 +61,12 @@ VideoCaptureMacQTKit::~VideoCaptureMacQTKit() ...@@ -61,8 +61,12 @@ VideoCaptureMacQTKit::~VideoCaptureMacQTKit()
if(_captureDevice) if(_captureDevice)
{ {
[_captureDevice registerOwner:nil]; [_captureDevice registerOwner:nil];
[_captureDevice stopCapture]; [_captureDevice performSelectorOnMainThread:@selector(stopCapture)
[_captureDevice release]; withObject:nil
waitUntilDone:NO];
[_captureDevice performSelectorOnMainThread:@selector(release)
withObject:nil
waitUntilDone:NO];
} }
if(_captureInfo) if(_captureInfo)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment