Bug 1167690 - Part 2: Integrate plugins which support the NPAPI audio extensions with the Audio Channel Service; r=BenWa

This commit is contained in:
Andrea Marchesini
2015-07-28 17:09:48 -04:00
committed by Ehsan Akhgari
parent 597fda6c6e
commit 9deb1d22c3
4 changed files with 122 additions and 16 deletions

View File

@@ -17,6 +17,7 @@
#include "nsHashKeys.h"
#include <prinrval.h>
#include "js/TypeDecls.h"
#include "nsIAudioChannelAgent.h"
#ifdef MOZ_WIDGET_ANDROID
#include "nsAutoPtr.h"
#include "nsIRunnable.h"
@@ -74,13 +75,14 @@ public:
bool needUnschedule;
};
class nsNPAPIPluginInstance : public nsISupports
class nsNPAPIPluginInstance final : public nsIAudioChannelAgentCallback
{
private:
typedef mozilla::PluginLibrary PluginLibrary;
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIAUDIOCHANNELAGENTCALLBACK
nsresult Initialize(nsNPAPIPlugin *aPlugin, nsPluginInstanceOwner* aOwner, const nsACString& aMIMEType);
nsresult Start();
@@ -117,6 +119,15 @@ public:
nsPluginInstanceOwner* GetOwner();
void SetOwner(nsPluginInstanceOwner *aOwner);
bool HasAudioChannelAgent() const
{
return !!mAudioChannelAgent;
}
nsresult GetOrCreateAudioChannelAgent(nsIAudioChannelAgent** aAgent);
nsresult SetMuted(bool aIsMuted);
nsNPAPIPlugin* GetPlugin();
nsresult GetNPP(NPP * aNPP);
@@ -404,6 +415,8 @@ private:
uint32_t mCachedParamLength;
char **mCachedParamNames;
char **mCachedParamValues;
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
};
// On Android, we need to guard against plugin code leaking entries in the local