Don't wait for a drain complete that will never happen

This prevents a deadlock that is due to the HTMLMediaElement calling MediaDecoder::NotifyOwnerActivityChanged() , attempt to grab the monitor, which is held by the SharedDecoderManager which is waiting for SetIdle() to complete.
This commit is contained in:
trav90
2017-03-05 02:37:53 -06:00
committed by roytam1
parent d534c47cc5
commit 870eefecb1
+10 -6
View File
@@ -98,9 +98,12 @@ SharedDecoderManager::CreateVideoDecoder(
mPDM = nullptr;
return nullptr;
}
mPDM = aPDM;
nsresult rv = mDecoder->Init();
NS_ENSURE_SUCCESS(rv, nullptr);
if (NS_FAILED(rv)) {
mDecoder = nullptr;
return nullptr;
}
mPDM = aPDM;
}
nsRefPtr<SharedDecoderProxy> proxy(new SharedDecoderProxy(this, aCallback));
@@ -148,10 +151,11 @@ SharedDecoderManager::SetIdle(MediaDataDecoder* aProxy)
{
if (aProxy && mActiveProxy == aProxy) {
mWaitForInternalDrain = true;
mActiveProxy->Drain();
MonitorAutoLock mon(mMonitor);
while (mWaitForInternalDrain) {
mon.Wait();
if (NS_SUCCEEDED(mActiveProxy->Drain())) {
MonitorAutoLock mon(mMonitor);
while (mWaitForInternalDrain) {
mon.Wait();
}
}
mActiveProxy->Flush();
mActiveProxy = nullptr;