зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1271491: [GMP] P5. Allow GMPDecoderModule::Init() to be called off the main thread. r=cpearce
MozReview-Commit-ID: FLToT0yNTbX --HG-- extra : rebase_source : c74ddd61d0160c3551380e5a141013759cfc4ec9
This commit is contained in:
Родитель
c16d1665b7
Коммит
3a843c40d0
|
@ -13,6 +13,7 @@
|
|||
#include "mozIGeckoMediaPluginService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
#include "gmp-audio-decode.h"
|
||||
#include "gmp-video-decode.h"
|
||||
#ifdef XP_WIN
|
||||
|
@ -112,7 +113,6 @@ HasGMPFor(const nsACString& aAPI,
|
|||
const nsACString& aCodec,
|
||||
const nsACString& aGMP)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
#ifdef XP_WIN
|
||||
// gmp-clearkey uses WMF for decoding, so if we're using clearkey we must
|
||||
// verify that WMF works before continuing.
|
||||
|
@ -130,6 +130,8 @@ HasGMPFor(const nsACString& aAPI,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
MOZ_ASSERT(NS_IsMainThread(),
|
||||
"HasPluginForAPI must be called on the main thread");
|
||||
nsTArray<nsCString> tags;
|
||||
tags.AppendElement(aCodec);
|
||||
tags.AppendElement(aGMP);
|
||||
|
@ -179,8 +181,13 @@ GMPDecoderModule::UpdateUsableCodecs()
|
|||
void
|
||||
GMPDecoderModule::Init()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableFunction([]() { Init(); });
|
||||
SyncRunnable::DispatchToThread(mainThread, runnable);
|
||||
return;
|
||||
}
|
||||
// GMPService::HasPluginForAPI is main thread only, so to implement
|
||||
// SupportsMimeType() we build a table of the codecs which each whitelisted
|
||||
// GMP has and update it when any GMPs are removed or added at runtime.
|
||||
|
|
Загрузка…
Ссылка в новой задаче