Bug 1268379 - Delay WMF checks in GMPParent - r?jesup
The WMF HasAAC/HasH264 checks were done off the main thread, as soon as the
plugin was loaded, which was way too soon in the overall startup process, when
the WMF subsystem may not have been properly initialized yet, or may be in the
middle of it.
The solution here is to delay these checks until they are actually needed to
respond to a format-support request, as they come later in the process.
Note: This may not be the ideal solution yet, as we are still relying on some
magic sequencing of events. Other avenues have been explored unsuccessfully
yet, but we may want to revisit this issue after this urgent patch has landed.
MozReview-Commit-ID: JVgINc5FLFx
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -570,16 +570,33 @@ GMPParent::SupportsAPI(const nsCString&
{
for (uint32_t i = 0; i < mCapabilities.Length(); i++) {
if (!mCapabilities[i].mAPIName.Equals(aAPI)) {
continue;
}
nsTArray<nsCString>& tags = mCapabilities[i].mAPITags;
for (uint32_t j = 0; j < tags.Length(); j++) {
if (tags[j].Equals(aTag)) {
+#ifdef XP_WIN
+ // Clearkey on Windows advertises that it can decode in its GMP info
+ // file, but uses Windows Media Foundation to decode. That's not present
+ // on Windows XP, and on some Vista, Windows N, and KN variants without
+ // certain services packs.
+ if (tags[j].EqualsLiteral("org.w3.clearkey")) {
+ if (mCapabilities[i].mAPIName.EqualsLiteral(GMP_API_VIDEO_DECODER)) {
+ if (!WMFDecoderModule::HasH264()) {
+ continue;
+ }
+ } else if (mCapabilities[i].mAPIName.EqualsLiteral(GMP_API_AUDIO_DECODER)) {
+ if (!WMFDecoderModule::HasAAC()) {
+ continue;
+ }
+ }
+ }
+#endif
return true;
}
}
}
return false;
}
bool
@@ -883,35 +900,16 @@ GMPParent::ReadGMPInfoFile(nsIFile* aFil
// SSE2 isn't supported.
if (cap.mAPITags.Contains(NS_LITERAL_CSTRING("com.adobe.primetime")) &&
!mozilla::supports_sse2()) {
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
}
#endif // XP_WIN
}
-#ifdef XP_WIN
- // Clearkey on Windows advertises that it can decode in its GMP info
- // file, but uses Windows Media Foundation to decode. That's not present
- // on Windows XP, and on some Vista, Windows N, and KN variants without
- // certain services packs. So don't add the decoding capability to
- // gmp-clearkey's GMPParent if it's not going to be able to use WMF to
- // decode.
- if (cap.mAPIName.EqualsLiteral(GMP_API_VIDEO_DECODER) &&
- cap.mAPITags.Contains(NS_LITERAL_CSTRING("org.w3.clearkey")) &&
- !WMFDecoderModule::HasH264()) {
- continue;
- }
- if (cap.mAPIName.EqualsLiteral(GMP_API_AUDIO_DECODER) &&
- cap.mAPITags.Contains(NS_LITERAL_CSTRING("org.w3.clearkey")) &&
- !WMFDecoderModule::HasAAC()) {
- continue;
- }
-#endif
-
mCapabilities.AppendElement(Move(cap));
}
if (mCapabilities.IsEmpty()) {
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
}
return GenericPromise::CreateAndResolve(true, __func__);