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
7aeed01333
commit
70f880c263
@ -305,6 +305,18 @@ MediaSourceDecoder::SetCDMProxy(CDMProxy* aProxy)
|
||||
rv = mReader->SetCDMProxy(aProxy);
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
|
@ -97,13 +97,22 @@ MediaSourceReader::IsWaitingOnCDMResource()
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
MOZ_ASSERT(!IsWaitingMediaResources());
|
||||
|
||||
for (auto& trackBuffer : mTrackBuffers) {
|
||||
if (trackBuffer->IsWaitingOnCDMResource()) {
|
||||
return true;
|
||||
}
|
||||
if (!mInfo.IsEncrypted()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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
|
||||
return false;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user