mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1024300 - Backout 72040861741d. r=burninator.
This commit is contained in:
parent
57cc15cedc
commit
adf34838ff
@ -420,26 +420,5 @@ GMPParent::ReadGMPMetaData()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
GMPParent::CanBeSharedCrossOrigin() const
|
||||
{
|
||||
return mOrigin.IsEmpty();
|
||||
}
|
||||
|
||||
bool
|
||||
GMPParent::CanBeUsedFrom(const nsAString& aOrigin) const
|
||||
{
|
||||
return (mOrigin.IsEmpty() && State() == GMPStateNotLoaded) ||
|
||||
mOrigin.Equals(aOrigin);
|
||||
}
|
||||
|
||||
void
|
||||
GMPParent::SetOrigin(const nsAString& aOrigin)
|
||||
{
|
||||
MOZ_ASSERT(!aOrigin.IsEmpty());
|
||||
MOZ_ASSERT(CanBeUsedFrom(aOrigin));
|
||||
mOrigin = aOrigin;
|
||||
}
|
||||
|
||||
} // namespace gmp
|
||||
} // namespace mozilla
|
||||
|
@ -56,27 +56,6 @@ public:
|
||||
nsIThread* GMPThread();
|
||||
#endif
|
||||
|
||||
// A GMP can either be a single instance shared across all origins (like
|
||||
// in the OpenH264 case), or we can require a new plugin instance for every
|
||||
// origin running the plugin (as in the EME plugin case).
|
||||
//
|
||||
// Plugins are associated with an origin by calling SetOrigin() before
|
||||
// loading.
|
||||
//
|
||||
// If a plugin has no origin specified and it is loaded, it is assumed to
|
||||
// be shared across origins.
|
||||
|
||||
// Specifies that a GMP can only work with the specified origin.
|
||||
void SetOrigin(const nsAString& aOrigin);
|
||||
|
||||
// Returns true if a plugin can be or is being used across multiple origins.
|
||||
bool CanBeSharedCrossOrigin() const;
|
||||
|
||||
// A GMP can be used from an origin if it's already been set to work with
|
||||
// that origin, or if it's not been set to work with any origin and has
|
||||
// not yet been loaded (i.e. it's not shared across origins).
|
||||
bool CanBeUsedFrom(const nsAString& aOrigin) const;
|
||||
|
||||
private:
|
||||
~GMPParent();
|
||||
bool EnsureProcessLoaded();
|
||||
@ -101,9 +80,6 @@ private:
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIThread> mGMPThread;
|
||||
#endif
|
||||
// Origin the plugin is assigned to, or empty if the the plugin is not
|
||||
// assigned to an origin.
|
||||
nsAutoString mOrigin;
|
||||
};
|
||||
|
||||
} // namespace gmp
|
||||
|
@ -191,23 +191,16 @@ GeckoMediaPluginService::GetThread(nsIThread** aThread)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GeckoMediaPluginService::GetGMPVideoDecoder(nsTArray<nsCString>* aTags,
|
||||
const nsAString& aOrigin,
|
||||
GMPVideoHost** aOutVideoHost,
|
||||
GMPVideoDecoder** aGMPVD)
|
||||
GeckoMediaPluginService::GetGMPVideoDecoderVP8(GMPVideoHost** aOutVideoHost, GMPVideoDecoder** aGMPVD)
|
||||
{
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
||||
NS_ENSURE_ARG(aTags && aTags->Length() > 0);
|
||||
NS_ENSURE_ARG(aOutVideoHost);
|
||||
NS_ENSURE_ARG(aGMPVD);
|
||||
|
||||
if (mShuttingDownOnGMPThread) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aOrigin,
|
||||
NS_LITERAL_CSTRING("decode-video"),
|
||||
*aTags);
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(NS_LITERAL_CSTRING("decode-video"),
|
||||
NS_LITERAL_CSTRING("vp8"));
|
||||
if (!gmp) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -225,23 +218,16 @@ GeckoMediaPluginService::GetGMPVideoDecoder(nsTArray<nsCString>* aTags,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GeckoMediaPluginService::GetGMPVideoEncoder(nsTArray<nsCString>* aTags,
|
||||
const nsAString& aOrigin,
|
||||
GMPVideoHost** aOutVideoHost,
|
||||
GMPVideoEncoder** aGMPVE)
|
||||
GeckoMediaPluginService::GetGMPVideoEncoderVP8(GMPVideoHost** aOutVideoHost, GMPVideoEncoder** aGMPVE)
|
||||
{
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
||||
NS_ENSURE_ARG(aTags && aTags->Length() > 0);
|
||||
NS_ENSURE_ARG(aOutVideoHost);
|
||||
NS_ENSURE_ARG(aGMPVE);
|
||||
|
||||
if (mShuttingDownOnGMPThread) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aOrigin,
|
||||
NS_LITERAL_CSTRING("encode-video"),
|
||||
*aTags);
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(NS_LITERAL_CSTRING("encode-video"),
|
||||
NS_LITERAL_CSTRING("vp8"));
|
||||
if (!gmp) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -273,50 +259,30 @@ GeckoMediaPluginService::UnloadPlugins()
|
||||
}
|
||||
|
||||
GMPParent*
|
||||
GeckoMediaPluginService::SelectPluginForAPI(const nsAString& aOrigin,
|
||||
const nsCString& aAPI,
|
||||
const nsTArray<nsCString>& aTags)
|
||||
GeckoMediaPluginService::SelectPluginForAPI(const nsCString& aAPI,
|
||||
const nsCString& aTag)
|
||||
{
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
||||
|
||||
GMPParent* gmp = SelectPluginFromListForAPI(aOrigin, aAPI, aTags);
|
||||
GMPParent* gmp = SelectPluginFromListForAPI(aAPI, aTag);
|
||||
if (gmp) {
|
||||
return gmp;
|
||||
}
|
||||
|
||||
RefreshPluginList();
|
||||
|
||||
return SelectPluginFromListForAPI(aOrigin, aAPI, aTags);
|
||||
return SelectPluginFromListForAPI(aAPI, aTag);
|
||||
}
|
||||
|
||||
GMPParent*
|
||||
GeckoMediaPluginService::SelectPluginFromListForAPI(const nsAString& aOrigin,
|
||||
const nsCString& aAPI,
|
||||
const nsTArray<nsCString>& aTags)
|
||||
GeckoMediaPluginService::SelectPluginFromListForAPI(const nsCString& aAPI,
|
||||
const nsCString& aTag)
|
||||
{
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
||||
|
||||
for (uint32_t i = 0; i < mPlugins.Length(); i++) {
|
||||
GMPParent* gmp = mPlugins[i];
|
||||
bool supportsAllTags = true;
|
||||
for (uint32_t t = 0; t < aTags.Length(); t++) {
|
||||
const nsCString& tag = aTags[t];
|
||||
if (!gmp->SupportsAPI(aAPI, tag)) {
|
||||
supportsAllTags = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!supportsAllTags) {
|
||||
continue;
|
||||
}
|
||||
if (aOrigin.IsEmpty()) {
|
||||
if (gmp->CanBeSharedCrossOrigin()) {
|
||||
return gmp;
|
||||
}
|
||||
} else if (gmp->CanBeUsedFrom(aOrigin)) {
|
||||
if (!aOrigin.IsEmpty()) {
|
||||
gmp->SetOrigin(aOrigin);
|
||||
}
|
||||
if (gmp->SupportsAPI(aAPI, aTag)) {
|
||||
return gmp;
|
||||
}
|
||||
}
|
||||
|
@ -38,12 +38,8 @@ public:
|
||||
private:
|
||||
~GeckoMediaPluginService();
|
||||
|
||||
GMPParent* SelectPluginFromListForAPI(const nsAString& aOrigin,
|
||||
const nsCString& aAPI,
|
||||
const nsTArray<nsCString>& aTags);
|
||||
GMPParent* SelectPluginForAPI(const nsAString& aOrigin,
|
||||
const nsCString& aAPI,
|
||||
const nsTArray<nsCString>& aTags);
|
||||
GMPParent* SelectPluginFromListForAPI(const nsCString& aAPI, const nsCString& aTag);
|
||||
GMPParent* SelectPluginForAPI(const nsCString& aAPI, const nsCString& aTag);
|
||||
void UnloadPlugins();
|
||||
|
||||
void RefreshPluginList();
|
||||
|
@ -96,7 +96,7 @@ GMPVideoHostImpl::ActorDestroyed()
|
||||
mEncodedFrames[i - 1]->ActorDestroyed();
|
||||
mEncodedFrames.RemoveElementAt(i - 1);
|
||||
}
|
||||
mSharedMemMgr = nullptr;
|
||||
mSharedMemMgr = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -16,7 +16,6 @@ class GMPVideoHost;
|
||||
[ptr] native GMPVideoEncoder(GMPVideoEncoder);
|
||||
[ptr] native GMPVideoHost(GMPVideoHost);
|
||||
[ptr] native MessageLoop(MessageLoop);
|
||||
[ptr] native TagArray(nsTArray<nsCString>);
|
||||
|
||||
[uuid(BF5A9086-70F5-4D38-832D-1609BBF963CD)]
|
||||
interface mozIGeckoMediaPluginService : nsISupports
|
||||
@ -25,19 +24,11 @@ interface mozIGeckoMediaPluginService : nsISupports
|
||||
// Callable from any thread.
|
||||
readonly attribute nsIThread thread;
|
||||
|
||||
// Returns a video decoder that supports the specified tags.
|
||||
// The array of tags should at least contain a codec tag, and optionally
|
||||
// other tags such as for EME keysystem.
|
||||
// Returns a video decoder API object that should support VP8.
|
||||
// Callable only on GMP thread.
|
||||
GMPVideoDecoder getGMPVideoDecoder(in TagArray tags,
|
||||
[optional] in AString origin,
|
||||
out GMPVideoHost outVideoHost);
|
||||
GMPVideoDecoder getGMPVideoDecoderVP8(out GMPVideoHost outVideoHost);
|
||||
|
||||
// Returns a video encoder that supports the specified tags.
|
||||
// The array of tags should at least contain a codec tag, and optionally
|
||||
// other tags.
|
||||
// Returns a video encoder API object that should support VP8.
|
||||
// Callable only on GMP thread.
|
||||
GMPVideoEncoder getGMPVideoEncoder(in TagArray tags,
|
||||
[optional] in AString origin,
|
||||
out GMPVideoHost outVideoHost);
|
||||
GMPVideoEncoder getGMPVideoEncoderVP8(out GMPVideoHost outVideoHost);
|
||||
};
|
||||
|
@ -123,12 +123,7 @@ WebrtcGmpVideoEncoder::InitEncode_g(const webrtc::VideoCodec* aCodecSettings,
|
||||
GMPVideoHost* host = nullptr;
|
||||
GMPVideoEncoder* gmp = nullptr;
|
||||
|
||||
nsTArray<nsCString> tags;
|
||||
tags.AppendElement(NS_LITERAL_CSTRING("vp8"));
|
||||
nsresult rv = mMPS->GetGMPVideoEncoder(&tags,
|
||||
NS_LITERAL_STRING(""),
|
||||
&host,
|
||||
&gmp);
|
||||
nsresult rv = mMPS->GetGMPVideoEncoderVP8(&host, &gmp);
|
||||
if (NS_FAILED(rv)) {
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
}
|
||||
@ -463,12 +458,8 @@ WebrtcGmpVideoDecoder::InitDecode_g(const webrtc::VideoCodec* aCodecSettings,
|
||||
GMPVideoHost* host = nullptr;
|
||||
GMPVideoDecoder* gmp = nullptr;
|
||||
|
||||
nsTArray<nsCString> tags;
|
||||
tags.AppendElement(NS_LITERAL_CSTRING("vp8"));
|
||||
if (NS_WARN_IF(NS_FAILED(mMPS->GetGMPVideoDecoder(&tags,
|
||||
NS_LITERAL_STRING(""),
|
||||
&host,
|
||||
&gmp)))) {
|
||||
if (NS_WARN_IF(NS_FAILED(mMPS->GetGMPVideoDecoderVP8(&host, &gmp))))
|
||||
{
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user