Bug 1257616: We can release Conduits immediately if we're on MainThread already r=drno

This commit is contained in:
Randell Jesup 2016-03-17 20:45:09 -04:00
parent cd9bdd29d1
commit 9865e1f013
2 changed files with 21 additions and 12 deletions

View File

@ -662,6 +662,7 @@ void
AudioCallbackDriver::Destroy()
{
STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver destroyed."));
mAudioInput = nullptr;
mAudioStream.reset();
}

View File

@ -463,12 +463,16 @@ public:
~PipelineListener()
{
// release conduit on mainthread. Must use forget()!
nsresult rv = NS_DispatchToMainThread(new
ConduitDeleteEvent(conduit_.forget()));
MOZ_ASSERT(!NS_FAILED(rv),"Could not dispatch conduit shutdown to main");
if (NS_FAILED(rv)) {
MOZ_CRASH();
if (!NS_IsMainThread()) {
// release conduit on mainthread. Must use forget()!
nsresult rv = NS_DispatchToMainThread(new
ConduitDeleteEvent(conduit_.forget()));
MOZ_ASSERT(!NS_FAILED(rv),"Could not dispatch conduit shutdown to main");
if (NS_FAILED(rv)) {
MOZ_CRASH();
}
} else {
conduit_ = nullptr;
}
}
@ -625,12 +629,16 @@ class MediaPipelineReceiveAudio : public MediaPipelineReceive {
~PipelineListener()
{
// release conduit on mainthread. Must use forget()!
nsresult rv = NS_DispatchToMainThread(new
ConduitDeleteEvent(conduit_.forget()));
MOZ_ASSERT(!NS_FAILED(rv),"Could not dispatch conduit shutdown to main");
if (NS_FAILED(rv)) {
MOZ_CRASH();
if (!NS_IsMainThread()) {
// release conduit on mainthread. Must use forget()!
nsresult rv = NS_DispatchToMainThread(new
ConduitDeleteEvent(conduit_.forget()));
MOZ_ASSERT(!NS_FAILED(rv),"Could not dispatch conduit shutdown to main");
if (NS_FAILED(rv)) {
MOZ_CRASH();
}
} else {
conduit_ = nullptr;
}
}