mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1147730 part 1 - Prevent data race between CDMProxy and CDM caps and video decoder startup. r=edwin
This commit is contained in:
parent
4d8d636fc1
commit
8d9721c9f7
@ -305,6 +305,18 @@ MediaSourceDecoder::SetCDMProxy(CDMProxy* aProxy)
|
|||||||
rv = mReader->SetCDMProxy(aProxy);
|
rv = mReader->SetCDMProxy(aProxy);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
{
|
||||||
|
// The sub readers can't decrypt EME content until they have a CDMProxy,
|
||||||
|
// and the CDMProxy knows the capabilities of the CDM. The MediaSourceReader
|
||||||
|
// remains in "waiting for resources" state until then. We need to kick the
|
||||||
|
// reader out of waiting if the CDM gets added with known capabilities.
|
||||||
|
CDMCaps::AutoLock caps(aProxy->Capabilites());
|
||||||
|
if (!caps.AreCapsKnown()) {
|
||||||
|
nsCOMPtr<nsIRunnable> task(
|
||||||
|
NS_NewRunnableMethod(this, &MediaDecoder::NotifyWaitingForResourcesStatusChanged));
|
||||||
|
caps.CallOnMainThreadWhenCapsAvailable(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -97,13 +97,22 @@ MediaSourceReader::IsWaitingOnCDMResource()
|
|||||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||||
MOZ_ASSERT(!IsWaitingMediaResources());
|
MOZ_ASSERT(!IsWaitingMediaResources());
|
||||||
|
|
||||||
for (auto& trackBuffer : mTrackBuffers) {
|
if (!mInfo.IsEncrypted()) {
|
||||||
if (trackBuffer->IsWaitingOnCDMResource()) {
|
return false;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
// We'll need to wait on the CDMProxy being added, and it having received
|
||||||
|
// notification from the child GMP of its capabilities; whether it can
|
||||||
|
// decode, or whether we need to decode on our side.
|
||||||
|
if (!mCDMProxy) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
CDMCaps::AutoLock caps(mCDMProxy->Capabilites());
|
||||||
|
return !caps.AreCapsKnown();
|
||||||
}
|
}
|
||||||
|
|
||||||
return mInfo.IsEncrypted() && !mCDMProxy;
|
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user