mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 847809 - Add audio/amr to the supported decode type of OMX, but disable it if this AMR is loaded from Web pages. r=roc
This commit is contained in:
parent
5abd5f2f05
commit
980d7af474
@ -7,6 +7,7 @@
|
||||
#include "DecoderTraits.h"
|
||||
#include "MediaDecoder.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
#ifdef MOZ_MEDIA_PLUGINS
|
||||
#include "MediaPluginHost.h"
|
||||
@ -195,9 +196,10 @@ IsGStreamerSupportedType(const nsACString& aMimeType)
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
static const char* const gOmxTypes[6] = {
|
||||
static const char* const gOmxTypes[7] = {
|
||||
"audio/mpeg",
|
||||
"audio/mp4",
|
||||
"audio/amr",
|
||||
"video/mp4",
|
||||
"video/3gpp",
|
||||
"video/quicktime",
|
||||
@ -399,6 +401,21 @@ DecoderTraits::CreateDecoder(const nsACString& aType, MediaDecoderOwner* aOwner)
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (IsOmxSupportedType(aType)) {
|
||||
// AMR audio is enabled for MMS, but we are discouraging Web and App
|
||||
// developers from using AMR, thus we only allow AMR to be played on WebApps.
|
||||
if (aType.EqualsASCII("audio/amr") || aType.EqualsASCII("video/3gpp")) {
|
||||
nsHTMLMediaElement* element = aOwner->GetMediaElement();
|
||||
if (!element) {
|
||||
return nullptr;
|
||||
}
|
||||
nsIPrincipal* principal = element->NodePrincipal();
|
||||
if (!principal) {
|
||||
return nullptr;
|
||||
}
|
||||
if (principal->GetAppStatus() < nsIPrincipal::APP_STATUS_PRIVILEGED) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
decoder = new MediaOmxDecoder();
|
||||
}
|
||||
#endif
|
||||
|
@ -78,6 +78,7 @@
|
||||
#define AUDIO_WEBM "audio/webm"
|
||||
#define AUDIO_MP3 "audio/mpeg"
|
||||
#define AUDIO_MP4 "audio/mp4"
|
||||
#define AUDIO_AMR "audio/amr"
|
||||
|
||||
#define BINARY_OCTET_STREAM "binary/octet-stream"
|
||||
|
||||
|
@ -480,6 +480,9 @@ static nsExtraMimeTypeEntry extraMimeEntries [] =
|
||||
{ APPLICATION_OGG, "ogg", "Ogg Video"},
|
||||
{ AUDIO_OGG, "oga", "Ogg Audio" },
|
||||
{ AUDIO_OGG, "opus", "Opus Audio" },
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
{ AUDIO_AMR, "amr", "Adaptive Multi-Rate Audio" },
|
||||
#endif
|
||||
{ VIDEO_WEBM, "webm", "Web Media Video" },
|
||||
{ AUDIO_WEBM, "webm", "Web Media Audio" },
|
||||
#ifdef MOZ_DASH
|
||||
|
Loading…
Reference in New Issue
Block a user