зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 1e532bbff55b (bug 1060179)
This commit is contained in:
Родитель
9a829fcf2f
Коммит
e7e1c29ef1
|
@ -41,12 +41,13 @@ CDMProxy::Init(PromiseId aPromiseId)
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
NS_ENSURE_TRUE_VOID(!mKeys.IsNull());
|
||||
|
||||
mNodeId = mKeys->GetNodeId();
|
||||
if (mNodeId.IsEmpty()) {
|
||||
nsresult rv = mKeys->GetOrigin(mOrigin);
|
||||
if (NS_FAILED(rv)) {
|
||||
RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
EME_LOG("Creating CDMProxy for origin='%s'", GetNodeId().get());
|
||||
EME_LOG("Creating CDMProxy for origin='%s'",
|
||||
NS_ConvertUTF16toUTF8(GetOrigin()).get());
|
||||
|
||||
if (!mGMPThread) {
|
||||
nsCOMPtr<mozIGeckoMediaPluginService> mps =
|
||||
|
@ -88,7 +89,7 @@ CDMProxy::gmp_Init(uint32_t aPromiseId)
|
|||
|
||||
nsTArray<nsCString> tags;
|
||||
tags.AppendElement(NS_ConvertUTF16toUTF8(mKeySystem));
|
||||
nsresult rv = mps->GetGMPDecryptor(&tags, GetNodeId(), &mCDM);
|
||||
nsresult rv = mps->GetGMPDecryptor(&tags, GetOrigin(), &mCDM);
|
||||
if (NS_FAILED(rv) || !mCDM) {
|
||||
RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
} else {
|
||||
|
@ -303,10 +304,8 @@ CDMProxy::Shutdown()
|
|||
mKeys.Clear();
|
||||
// Note: This may end up being the last owning reference to the CDMProxy.
|
||||
nsRefPtr<nsIRunnable> task(NS_NewRunnableMethod(this, &CDMProxy::gmp_Shutdown));
|
||||
if (mGMPThread) {
|
||||
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CDMProxy::gmp_Shutdown()
|
||||
|
@ -357,10 +356,10 @@ CDMProxy::ResolvePromise(PromiseId aId)
|
|||
}
|
||||
}
|
||||
|
||||
const nsCString&
|
||||
CDMProxy::GetNodeId() const
|
||||
const nsAString&
|
||||
CDMProxy::GetOrigin() const
|
||||
{
|
||||
return mNodeId;
|
||||
return mOrigin;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -102,7 +102,7 @@ public:
|
|||
void Shutdown();
|
||||
|
||||
// Threadsafe.
|
||||
const nsCString& GetNodeId() const;
|
||||
const nsAString& GetOrigin() const;
|
||||
|
||||
// Main thread only.
|
||||
void OnResolveNewSessionPromise(uint32_t aPromiseId,
|
||||
|
@ -286,7 +286,7 @@ private:
|
|||
// EME plugin must come from this thread.
|
||||
nsRefPtr<nsIThread> mGMPThread;
|
||||
|
||||
nsCString mNodeId;
|
||||
nsAutoString mOrigin;
|
||||
|
||||
GMPDecryptorProxy* mCDM;
|
||||
CDMCaps mCapabilites;
|
||||
|
|
|
@ -366,17 +366,12 @@ MediaKeys::GetSession(const nsAString& aSessionId)
|
|||
return session.forget();
|
||||
}
|
||||
|
||||
const nsCString&
|
||||
MediaKeys::GetNodeId()
|
||||
nsresult
|
||||
MediaKeys::GetOrigin(nsString& aOutOrigin)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// TODO: Bug 1035637, return a combination of origin and URL bar origin.
|
||||
|
||||
if (!mNodeId.IsEmpty()) {
|
||||
return mNodeId;
|
||||
}
|
||||
|
||||
nsIPrincipal* principal = nullptr;
|
||||
nsCOMPtr<nsPIDOMWindow> pWindow = do_QueryInterface(GetParentObject());
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> scriptPrincipal =
|
||||
|
@ -384,13 +379,13 @@ MediaKeys::GetNodeId()
|
|||
if (scriptPrincipal) {
|
||||
principal = scriptPrincipal->GetPrincipal();
|
||||
}
|
||||
nsAutoString id;
|
||||
if (principal && NS_SUCCEEDED(nsContentUtils::GetUTFOrigin(principal, id))) {
|
||||
CopyUTF16toUTF8(id, mNodeId);
|
||||
EME_LOG("EME Origin = '%s'", mNodeId.get());
|
||||
}
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||
|
||||
return mNodeId;
|
||||
nsresult res = nsContentUtils::GetUTFOrigin(principal, aOutOrigin);
|
||||
|
||||
EME_LOG("EME Origin = '%s'", NS_ConvertUTF16toUTF8(aOutOrigin).get());
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
// Resolves promise with "undefined".
|
||||
void ResolvePromise(PromiseId aId);
|
||||
|
||||
const nsCString& GetNodeId();
|
||||
nsresult GetOrigin(nsString& aOutOrigin);
|
||||
|
||||
void Shutdown();
|
||||
|
||||
|
@ -122,7 +122,6 @@ private:
|
|||
|
||||
nsCOMPtr<nsPIDOMWindow> mParent;
|
||||
nsString mKeySystem;
|
||||
nsCString mNodeId;
|
||||
KeySessionHashMap mKeySessions;
|
||||
PromiseHashMap mPromises;
|
||||
PendingKeySessionsHashMap mPendingSessions;
|
||||
|
|
|
@ -242,7 +242,7 @@ EMEAudioDecoder::GmpInit()
|
|||
tags.AppendElement(NS_LITERAL_CSTRING("aac"));
|
||||
tags.AppendElement(NS_ConvertUTF16toUTF8(mProxy->KeySystem()));
|
||||
nsresult rv = mMPS->GetGMPAudioDecoder(&tags,
|
||||
mProxy->GetNodeId(),
|
||||
mProxy->GetOrigin(),
|
||||
&mGMP);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(mGMP);
|
||||
|
|
|
@ -233,7 +233,7 @@ EMEH264Decoder::GmpInit()
|
|||
tags.AppendElement(NS_LITERAL_CSTRING("h264"));
|
||||
tags.AppendElement(NS_ConvertUTF16toUTF8(mProxy->KeySystem()));
|
||||
nsresult rv = mMPS->GetGMPVideoDecoder(&tags,
|
||||
mProxy->GetNodeId(),
|
||||
mProxy->GetOrigin(),
|
||||
&mHost,
|
||||
&mGMP);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -680,7 +680,7 @@ GMPParent::DeallocPGMPAudioDecoderParent(PGMPAudioDecoderParent* aActor)
|
|||
PGMPStorageParent*
|
||||
GMPParent::AllocPGMPStorageParent()
|
||||
{
|
||||
GMPStorageParent* p = new GMPStorageParent(mNodeId, this);
|
||||
GMPStorageParent* p = new GMPStorageParent(mOrigin, this);
|
||||
mStorage.AppendElement(p); // Addrefs, released in DeallocPGMPStorageParent.
|
||||
return p;
|
||||
}
|
||||
|
@ -877,24 +877,24 @@ GMPParent::ReadGMPMetaData()
|
|||
}
|
||||
|
||||
bool
|
||||
GMPParent::CanBeSharedCrossNodeIds() const
|
||||
GMPParent::CanBeSharedCrossOrigin() const
|
||||
{
|
||||
return mNodeId.IsEmpty();
|
||||
return mOrigin.IsEmpty();
|
||||
}
|
||||
|
||||
bool
|
||||
GMPParent::CanBeUsedFrom(const nsACString& aNodeId) const
|
||||
GMPParent::CanBeUsedFrom(const nsAString& aOrigin) const
|
||||
{
|
||||
return (mNodeId.IsEmpty() && State() == GMPStateNotLoaded) ||
|
||||
mNodeId == aNodeId;
|
||||
return (mOrigin.IsEmpty() && State() == GMPStateNotLoaded) ||
|
||||
mOrigin.Equals(aOrigin);
|
||||
}
|
||||
|
||||
void
|
||||
GMPParent::SetNodeId(const nsACString& aNodeId)
|
||||
GMPParent::SetOrigin(const nsAString& aOrigin)
|
||||
{
|
||||
MOZ_ASSERT(!aNodeId.IsEmpty());
|
||||
MOZ_ASSERT(CanBeUsedFrom(aNodeId));
|
||||
mNodeId = aNodeId;
|
||||
MOZ_ASSERT(!aOrigin.IsEmpty());
|
||||
MOZ_ASSERT(CanBeUsedFrom(aOrigin));
|
||||
mOrigin = aOrigin;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -99,28 +99,26 @@ public:
|
|||
GMPState State() const;
|
||||
nsIThread* GMPThread();
|
||||
|
||||
// A GMP can either be a single instance shared across all NodeIds (like
|
||||
// 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
|
||||
// NodeIds running the plugin (as in the EME plugin case).
|
||||
// origin running the plugin (as in the EME plugin case).
|
||||
//
|
||||
// A NodeId is a hash of the ($urlBarOrigin, $ownerDocOrigin) pair.
|
||||
//
|
||||
// Plugins are associated with an NodeIds by calling SetNodeId() before
|
||||
// Plugins are associated with an origin by calling SetOrigin() before
|
||||
// loading.
|
||||
//
|
||||
// If a plugin has no NodeId specified and it is loaded, it is assumed to
|
||||
// be shared across NodeIds.
|
||||
// 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 NodeIds.
|
||||
void SetNodeId(const nsACString& aNodeId);
|
||||
// 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 NodeIds.
|
||||
bool CanBeSharedCrossNodeIds() const;
|
||||
// Returns true if a plugin can be or is being used across multiple origins.
|
||||
bool CanBeSharedCrossOrigin() const;
|
||||
|
||||
// A GMP can be used from a NodeId if it's already been set to work with
|
||||
// that NodeId, or if it's not been set to work with any NodeId and has
|
||||
// not yet been loaded (i.e. it's not shared across NodeIds).
|
||||
bool CanBeUsedFrom(const nsACString& aNodeId) 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;
|
||||
|
||||
already_AddRefed<nsIFile> GetDirectory() {
|
||||
return nsCOMPtr<nsIFile>(mDirectory).forget();
|
||||
|
@ -186,9 +184,9 @@ private:
|
|||
nsTArray<nsRefPtr<GMPTimerParent>> mTimers;
|
||||
nsTArray<nsRefPtr<GMPStorageParent>> mStorage;
|
||||
nsCOMPtr<nsIThread> mGMPThread;
|
||||
// NodeId the plugin is assigned to, or empty if the the plugin is not
|
||||
// assigned to a NodeId.
|
||||
nsAutoCString mNodeId;
|
||||
// Origin the plugin is assigned to, or empty if the the plugin is not
|
||||
// assigned to an origin.
|
||||
nsAutoString mOrigin;
|
||||
|
||||
bool mAsyncShutdownRequired;
|
||||
bool mAsyncShutdownInProgress;
|
||||
|
|
|
@ -324,7 +324,7 @@ GeckoMediaPluginService::GetThread(nsIThread** aThread)
|
|||
|
||||
NS_IMETHODIMP
|
||||
GeckoMediaPluginService::GetGMPAudioDecoder(nsTArray<nsCString>* aTags,
|
||||
const nsACString& aNodeId,
|
||||
const nsAString& aOrigin,
|
||||
GMPAudioDecoderProxy** aGMPAD)
|
||||
{
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
||||
|
@ -335,7 +335,7 @@ GeckoMediaPluginService::GetGMPAudioDecoder(nsTArray<nsCString>* aTags,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aNodeId,
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aOrigin,
|
||||
NS_LITERAL_CSTRING("decode-audio"),
|
||||
*aTags);
|
||||
if (!gmp) {
|
||||
|
@ -355,7 +355,7 @@ GeckoMediaPluginService::GetGMPAudioDecoder(nsTArray<nsCString>* aTags,
|
|||
|
||||
NS_IMETHODIMP
|
||||
GeckoMediaPluginService::GetGMPVideoDecoder(nsTArray<nsCString>* aTags,
|
||||
const nsACString& aNodeId,
|
||||
const nsAString& aOrigin,
|
||||
GMPVideoHost** aOutVideoHost,
|
||||
GMPVideoDecoderProxy** aGMPVD)
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ GeckoMediaPluginService::GetGMPVideoDecoder(nsTArray<nsCString>* aTags,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aNodeId,
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aOrigin,
|
||||
NS_LITERAL_CSTRING("decode-video"),
|
||||
*aTags);
|
||||
#ifdef PR_LOGGING
|
||||
|
@ -394,7 +394,7 @@ GeckoMediaPluginService::GetGMPVideoDecoder(nsTArray<nsCString>* aTags,
|
|||
|
||||
NS_IMETHODIMP
|
||||
GeckoMediaPluginService::GetGMPVideoEncoder(nsTArray<nsCString>* aTags,
|
||||
const nsACString& aNodeId,
|
||||
const nsAString& aOrigin,
|
||||
GMPVideoHost** aOutVideoHost,
|
||||
GMPVideoEncoderProxy** aGMPVE)
|
||||
{
|
||||
|
@ -407,7 +407,7 @@ GeckoMediaPluginService::GetGMPVideoEncoder(nsTArray<nsCString>* aTags,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aNodeId,
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aOrigin,
|
||||
NS_LITERAL_CSTRING("encode-video"),
|
||||
*aTags);
|
||||
#ifdef PR_LOGGING
|
||||
|
@ -432,7 +432,7 @@ GeckoMediaPluginService::GetGMPVideoEncoder(nsTArray<nsCString>* aTags,
|
|||
|
||||
NS_IMETHODIMP
|
||||
GeckoMediaPluginService::GetGMPDecryptor(nsTArray<nsCString>* aTags,
|
||||
const nsACString& aNodeId,
|
||||
const nsAString& aOrigin,
|
||||
GMPDecryptorProxy** aDecryptor)
|
||||
{
|
||||
#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
|
||||
|
@ -451,7 +451,7 @@ GeckoMediaPluginService::GetGMPDecryptor(nsTArray<nsCString>* aTags,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aNodeId,
|
||||
nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aOrigin,
|
||||
NS_LITERAL_CSTRING("eme-decrypt"),
|
||||
*aTags);
|
||||
if (!gmp) {
|
||||
|
@ -658,7 +658,7 @@ GeckoMediaPluginService::RemovePluginDirectory(const nsAString& aDirectory)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GeckoMediaPluginService::HasPluginForAPI(const nsACString& aNodeId,
|
||||
GeckoMediaPluginService::HasPluginForAPI(const nsAString& aOrigin,
|
||||
const nsACString& aAPI,
|
||||
nsTArray<nsCString>* aTags,
|
||||
bool* aResult)
|
||||
|
@ -667,19 +667,19 @@ GeckoMediaPluginService::HasPluginForAPI(const nsACString& aNodeId,
|
|||
NS_ENSURE_ARG(aResult);
|
||||
|
||||
nsCString temp(aAPI);
|
||||
GMPParent *parent = SelectPluginForAPI(aNodeId, temp, *aTags, false);
|
||||
GMPParent *parent = SelectPluginForAPI(aOrigin, temp, *aTags, false);
|
||||
*aResult = !!parent;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
GMPParent*
|
||||
GeckoMediaPluginService::SelectPluginForAPI(const nsACString& aNodeId,
|
||||
GeckoMediaPluginService::SelectPluginForAPI(const nsAString& aOrigin,
|
||||
const nsCString& aAPI,
|
||||
const nsTArray<nsCString>& aTags,
|
||||
bool aCloneCrossNodeIds)
|
||||
bool aCloneCrossOrigin)
|
||||
{
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread || !aCloneCrossNodeIds,
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread || !aCloneCrossOrigin,
|
||||
"Can't clone GMP plugins on non-GMP threads.");
|
||||
|
||||
GMPParent* gmpToClone = nullptr;
|
||||
|
@ -698,13 +698,14 @@ GeckoMediaPluginService::SelectPluginForAPI(const nsACString& aNodeId,
|
|||
if (!supportsAllTags) {
|
||||
continue;
|
||||
}
|
||||
if (aNodeId.IsEmpty()) {
|
||||
if (gmp->CanBeSharedCrossNodeIds()) {
|
||||
if (aOrigin.IsEmpty()) {
|
||||
if (gmp->CanBeSharedCrossOrigin()) {
|
||||
return gmp;
|
||||
}
|
||||
} else if (gmp->CanBeUsedFrom(aNodeId)) {
|
||||
MOZ_ASSERT(!aNodeId.IsEmpty());
|
||||
gmp->SetNodeId(aNodeId);
|
||||
} else if (gmp->CanBeUsedFrom(aOrigin)) {
|
||||
if (!aOrigin.IsEmpty()) {
|
||||
gmp->SetOrigin(aOrigin);
|
||||
}
|
||||
return gmp;
|
||||
}
|
||||
|
||||
|
@ -716,10 +717,10 @@ GeckoMediaPluginService::SelectPluginForAPI(const nsACString& aNodeId,
|
|||
|
||||
// Plugin exists, but we can't use it due to cross-origin separation. Create a
|
||||
// new one.
|
||||
if (aCloneCrossNodeIds && gmpToClone) {
|
||||
if (aCloneCrossOrigin && gmpToClone) {
|
||||
GMPParent* clone = ClonePlugin(gmpToClone);
|
||||
if (!aNodeId.IsEmpty()) {
|
||||
clone->SetNodeId(aNodeId);
|
||||
if (!aOrigin.IsEmpty()) {
|
||||
clone->SetOrigin(aOrigin);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
|
|
@ -45,10 +45,10 @@ public:
|
|||
private:
|
||||
~GeckoMediaPluginService();
|
||||
|
||||
GMPParent* SelectPluginForAPI(const nsACString& aNodeId,
|
||||
GMPParent* SelectPluginForAPI(const nsAString& aOrigin,
|
||||
const nsCString& aAPI,
|
||||
const nsTArray<nsCString>& aTags,
|
||||
bool aCloneCrossNodeIds = true);
|
||||
bool aCloneCrossOrigin = true);
|
||||
|
||||
void UnloadPlugins();
|
||||
void CrashPlugins();
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
// We store the records in files in the system temp dir.
|
||||
static nsresult
|
||||
GetGMPStorageDir(nsIFile** aTempDir, const nsCString& aNodeId)
|
||||
GetGMPStorageDir(nsIFile** aTempDir, const nsString& aOrigin)
|
||||
{
|
||||
if (NS_WARN_IF(!aTempDir)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
@ -82,7 +82,7 @@ GetGMPStorageDir(nsIFile** aTempDir, const nsCString& aNodeId)
|
|||
// process (a UUID or somesuch), we can just append it un-hashed here.
|
||||
// This should reduce the chance of hash collsions exposing data.
|
||||
nsAutoString nodeIdHash;
|
||||
nodeIdHash.AppendInt(HashString(aNodeId));
|
||||
nodeIdHash.AppendInt(HashString(static_cast<const char16_t*>(aOrigin.get())));
|
||||
rv = tmpFile->Append(nodeIdHash);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -98,9 +98,9 @@ GetGMPStorageDir(nsIFile** aTempDir, const nsCString& aNodeId)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
GMPStorageParent::GMPStorageParent(const nsCString& aNodeId,
|
||||
GMPStorageParent::GMPStorageParent(const nsString& aOrigin,
|
||||
GMPParent* aPlugin)
|
||||
: mNodeId(aNodeId)
|
||||
: mOrigin(aOrigin)
|
||||
, mPlugin(aPlugin)
|
||||
, mShutdown(false)
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ enum OpenFileMode { ReadWrite, Truncate };
|
|||
|
||||
nsresult
|
||||
OpenStorageFile(const nsCString& aRecordName,
|
||||
const nsCString& aNodeId,
|
||||
const nsString& aNodeId,
|
||||
const OpenFileMode aMode,
|
||||
PRFileDesc** aOutFD)
|
||||
{
|
||||
|
@ -141,10 +141,10 @@ GMPStorageParent::RecvOpen(const nsCString& aRecordName)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (mNodeId.EqualsLiteral("null")) {
|
||||
// Refuse to open storage if the page is opened from local disk,
|
||||
// or shared across origin.
|
||||
NS_WARNING("Refusing to open storage for null NodeId");
|
||||
if (mOrigin.EqualsASCII("null")) {
|
||||
// Refuse to open storage if the page is the "null" origin; if the page
|
||||
// is opened from disk.
|
||||
NS_WARNING("Refusing to open storage for null origin");
|
||||
unused << SendOpenComplete(aRecordName, GMPGenericErr);
|
||||
return true;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ GMPStorageParent::RecvOpen(const nsCString& aRecordName)
|
|||
}
|
||||
|
||||
PRFileDesc* fd = nullptr;
|
||||
nsresult rv = OpenStorageFile(aRecordName, mNodeId, ReadWrite, &fd);
|
||||
nsresult rv = OpenStorageFile(aRecordName, mOrigin, ReadWrite, &fd);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to open storage file.");
|
||||
unused << SendOpenComplete(aRecordName, GMPGenericErr);
|
||||
|
@ -224,7 +224,7 @@ GMPStorageParent::RecvWrite(const nsCString& aRecordName,
|
|||
// in truncate mode, to clear its contents.
|
||||
PR_Close(fd);
|
||||
mFiles.Remove(aRecordName);
|
||||
if (NS_FAILED(OpenStorageFile(aRecordName, mNodeId, Truncate, &fd))) {
|
||||
if (NS_FAILED(OpenStorageFile(aRecordName, mOrigin, Truncate, &fd))) {
|
||||
unused << SendWriteComplete(aRecordName, GMPGenericErr);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class GMPParent;
|
|||
class GMPStorageParent : public PGMPStorageParent {
|
||||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(GMPStorageParent)
|
||||
GMPStorageParent(const nsCString& aNodeId, GMPParent* aPlugin);
|
||||
GMPStorageParent(const nsString& aOrigin, GMPParent* aPlugin);
|
||||
|
||||
void Shutdown();
|
||||
|
||||
|
@ -36,7 +36,7 @@ private:
|
|||
~GMPStorageParent() {}
|
||||
|
||||
nsDataHashtable<nsCStringHashKey, PRFileDesc*> mFiles;
|
||||
const nsAutoCString mNodeId;
|
||||
const nsString mOrigin;
|
||||
nsRefPtr<GMPParent> mPlugin;
|
||||
bool mShutdown;
|
||||
};
|
||||
|
|
|
@ -25,10 +25,9 @@ class GMPVideoHost;
|
|||
[ptr] native GMPDecryptorProxy(GMPDecryptorProxy);
|
||||
[ptr] native GMPAudioDecoderProxy(GMPAudioDecoderProxy);
|
||||
|
||||
[scriptable, uuid(88ade941-a423-48f9-aa3d-a383af8de4b8)]
|
||||
[scriptable, uuid(6ea374fc-32ad-46f6-ae9d-80b668f4fd49)]
|
||||
interface mozIGeckoMediaPluginService : nsISupports
|
||||
{
|
||||
|
||||
/**
|
||||
* The GMP thread. Callable from any thread.
|
||||
*/
|
||||
|
@ -39,7 +38,7 @@ interface mozIGeckoMediaPluginService : nsISupports
|
|||
* Callable on any thread
|
||||
*/
|
||||
[noscript]
|
||||
boolean hasPluginForAPI([optional] in ACString nodeId,
|
||||
boolean hasPluginForAPI([optional] in AString origin,
|
||||
in ACString api,
|
||||
in TagArray tags);
|
||||
|
||||
|
@ -51,7 +50,7 @@ interface mozIGeckoMediaPluginService : nsISupports
|
|||
*/
|
||||
[noscript]
|
||||
GMPVideoDecoderProxy getGMPVideoDecoder(in TagArray tags,
|
||||
[optional] in ACString nodeId,
|
||||
[optional] in AString origin,
|
||||
out GMPVideoHost outVideoHost);
|
||||
|
||||
/**
|
||||
|
@ -62,7 +61,7 @@ interface mozIGeckoMediaPluginService : nsISupports
|
|||
*/
|
||||
[noscript]
|
||||
GMPVideoEncoderProxy getGMPVideoEncoder(in TagArray tags,
|
||||
[optional] in ACString nodeId,
|
||||
[optional] in AString origin,
|
||||
out GMPVideoHost outVideoHost);
|
||||
|
||||
// Returns an audio decoder that supports the specified tags.
|
||||
|
@ -70,13 +69,13 @@ interface mozIGeckoMediaPluginService : nsISupports
|
|||
// other tags such as for EME keysystem.
|
||||
// Callable only on GMP thread.
|
||||
GMPAudioDecoderProxy getGMPAudioDecoder(in TagArray tags,
|
||||
[optional] in ACString nodeId);
|
||||
[optional] in AString origin);
|
||||
|
||||
// Returns a decryption session manager that supports the specified tags.
|
||||
// The array of tags should at least contain a key system tag, and optionally
|
||||
// other tags.
|
||||
// Callable only on GMP thread.
|
||||
GMPDecryptorProxy getGMPDecryptor(in TagArray tags, in ACString nodeId);
|
||||
GMPDecryptorProxy getGMPDecryptor(in TagArray tags, in AString origin);
|
||||
|
||||
/**
|
||||
* Add a directory to scan for gecko media plugins.
|
||||
|
|
|
@ -171,7 +171,7 @@ WebrtcGmpVideoEncoder::InitEncode_g(const webrtc::VideoCodec* aCodecSettings,
|
|||
nsTArray<nsCString> tags;
|
||||
tags.AppendElement(NS_LITERAL_CSTRING("h264"));
|
||||
if (NS_WARN_IF(NS_FAILED(mMPS->GetGMPVideoEncoder(&tags,
|
||||
NS_LITERAL_CSTRING(""),
|
||||
NS_LITERAL_STRING(""),
|
||||
&mHost,
|
||||
&mGMP)))) {
|
||||
mMPS = nullptr;
|
||||
|
@ -255,7 +255,7 @@ WebrtcGmpVideoEncoder::Encode_g(const webrtc::I420VideoFrame* aInputImage,
|
|||
nsTArray<nsCString> tags;
|
||||
tags.AppendElement(NS_LITERAL_CSTRING("h264"));
|
||||
if (NS_WARN_IF(NS_FAILED(mMPS->GetGMPVideoEncoder(&tags,
|
||||
NS_LITERAL_CSTRING(""),
|
||||
NS_LITERAL_STRING(""),
|
||||
&mHost,
|
||||
&mGMP)))) {
|
||||
mGMP = nullptr;
|
||||
|
@ -558,7 +558,7 @@ WebrtcGmpVideoDecoder::InitDecode_g(const webrtc::VideoCodec* aCodecSettings,
|
|||
nsTArray<nsCString> tags;
|
||||
tags.AppendElement(NS_LITERAL_CSTRING("h264"));
|
||||
if (NS_WARN_IF(NS_FAILED(mMPS->GetGMPVideoDecoder(&tags,
|
||||
NS_LITERAL_CSTRING(""),
|
||||
NS_LITERAL_STRING(""),
|
||||
&mHost,
|
||||
&mGMP)))) {
|
||||
mMPS = nullptr;
|
||||
|
|
|
@ -203,7 +203,7 @@ int VcmSIPCCBinding::getVideoCodecsGmp()
|
|||
// H.264 only for now
|
||||
bool has_gmp;
|
||||
nsresult rv;
|
||||
rv = gSelf->mGMPService->HasPluginForAPI(NS_LITERAL_CSTRING(""),
|
||||
rv = gSelf->mGMPService->HasPluginForAPI(NS_LITERAL_STRING(""),
|
||||
NS_LITERAL_CSTRING("encode-video"),
|
||||
&tags,
|
||||
&has_gmp);
|
||||
|
@ -211,7 +211,7 @@ int VcmSIPCCBinding::getVideoCodecsGmp()
|
|||
return 0;
|
||||
}
|
||||
|
||||
rv = gSelf->mGMPService->HasPluginForAPI(NS_LITERAL_CSTRING(""),
|
||||
rv = gSelf->mGMPService->HasPluginForAPI(NS_LITERAL_STRING(""),
|
||||
NS_LITERAL_CSTRING("decode-video"),
|
||||
&tags,
|
||||
&has_gmp);
|
||||
|
|
Загрузка…
Ссылка в новой задаче