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)
void
CamerasParent::StopVideoCapture()
{
LOG((__PRETTY_FUNCTION__));
// We are called from the main thread (xpcom-shutdown) or
// from PBackground (when the Actor shuts down).
// Shut down the WebRTC stack (on the capture thread)
......@@ -407,6 +408,7 @@ CamerasParent::SetupEngine(CaptureEngine aCapEngine)
void
CamerasParent::CloseEngines()
{
LOG((__PRETTY_FUNCTION__));
if (!mWebRTCAlive) {
return;
}
......@@ -700,10 +702,12 @@ CamerasParent::RecvReleaseCaptureDevice(const int& aCapEngine,
RefPtr<nsIRunnable> ipc_runnable =
media::NewRunnableFrom([self, error, numdev]() -> nsresult {
if (self->IsShuttingDown()) {
LOG(("In Shutdown, not Releasing"));
return NS_ERROR_FAILURE;
}
if (error) {
Unused << self->SendReplyFailure();
LOG(("Failed to free device nr %d", numdev));
return NS_ERROR_FAILURE;
} else {
Unused << self->SendReplySuccess();
......
......@@ -61,8 +61,12 @@ VideoCaptureMacQTKit::~VideoCaptureMacQTKit()
if(_captureDevice)
{
[_captureDevice registerOwner:nil];
[_captureDevice stopCapture];
[_captureDevice release];
[_captureDevice performSelectorOnMainThread:@selector(stopCapture)
withObject:nil
waitUntilDone:NO];
[_captureDevice performSelectorOnMainThread:@selector(release)
withObject:nil
waitUntilDone:NO];
}
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