forked from pool/MozillaFirefox
16dbe14e33
* requires NSS 3.14.1 * removed obsolete SLE11 patches (mozilla-gcc43*) - ported patches - reenable WebRTC OBS-URL: https://build.opensuse.org/package/show/mozilla:Factory/MozillaFirefox?expand=0&rev=308
294 lines
8.6 KiB
Diff
294 lines
8.6 KiB
Diff
# HG changeset patch
|
|
# Parent 09328afa274e7cf6354f446ae37735218b796e7f
|
|
# User Wolfgang Rosenauer <wr@rosenauer.org>
|
|
Bug 803287 - Don't use GStreamer (when enabled) for Ogg/WebM if builtin backends present. (TM: 19)
|
|
|
|
diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp
|
|
--- a/content/base/src/nsContentUtils.cpp
|
|
+++ b/content/base/src/nsContentUtils.cpp
|
|
@@ -6676,71 +6676,55 @@ nsContentUtils::FindInternalContentViewe
|
|
else
|
|
*aLoaderType = TYPE_UNKNOWN;
|
|
}
|
|
return docFactory.forget();
|
|
}
|
|
|
|
#ifdef MOZ_MEDIA
|
|
#ifdef MOZ_OGG
|
|
- if (nsHTMLMediaElement::IsOggEnabled()) {
|
|
- for (unsigned int i = 0; i < ArrayLength(nsHTMLMediaElement::gOggTypes); ++i) {
|
|
- const char* type = nsHTMLMediaElement::gOggTypes[i];
|
|
- if (!strcmp(aType, type)) {
|
|
- docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
|
- if (docFactory && aLoaderType) {
|
|
- *aLoaderType = TYPE_CONTENT;
|
|
- }
|
|
- return docFactory.forget();
|
|
- }
|
|
+ if (nsHTMLMediaElement::IsOggType(nsDependentCString(aType))) {
|
|
+ docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
|
+ if (docFactory && aLoaderType) {
|
|
+ *aLoaderType = TYPE_CONTENT;
|
|
}
|
|
+ return docFactory.forget();
|
|
}
|
|
#endif
|
|
|
|
#ifdef MOZ_WEBM
|
|
- if (nsHTMLMediaElement::IsWebMEnabled()) {
|
|
- for (unsigned int i = 0; i < ArrayLength(nsHTMLMediaElement::gWebMTypes); ++i) {
|
|
- const char* type = nsHTMLMediaElement::gWebMTypes[i];
|
|
- if (!strcmp(aType, type)) {
|
|
- docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
|
- if (docFactory && aLoaderType) {
|
|
- *aLoaderType = TYPE_CONTENT;
|
|
- }
|
|
- return docFactory.forget();
|
|
- }
|
|
+ if (nsHTMLMediaElement::IsWebMType(nsDependentCString(aType))) {
|
|
+ docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
|
+ if (docFactory && aLoaderType) {
|
|
+ *aLoaderType = TYPE_CONTENT;
|
|
}
|
|
+ return docFactory.forget();
|
|
}
|
|
#endif
|
|
|
|
#ifdef MOZ_GSTREAMER
|
|
- if (nsHTMLMediaElement::IsH264Enabled()) {
|
|
- for (unsigned int i = 0; i < ArrayLength(nsHTMLMediaElement::gH264Types); ++i) {
|
|
- const char* type = nsHTMLMediaElement::gH264Types[i];
|
|
- if (!strcmp(aType, type)) {
|
|
- docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
|
- if (docFactory && aLoaderType) {
|
|
- *aLoaderType = TYPE_CONTENT;
|
|
- }
|
|
- return docFactory.forget();
|
|
- }
|
|
+ if (nsHTMLMediaElement::IsGStreamerSupportedType(nsDependentCString(aType))) {
|
|
+ docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
|
+ if (docFactory && aLoaderType) {
|
|
+ *aLoaderType = TYPE_CONTENT;
|
|
}
|
|
+ return docFactory.forget();
|
|
}
|
|
#endif
|
|
|
|
#ifdef MOZ_MEDIA_PLUGINS
|
|
if (nsHTMLMediaElement::IsMediaPluginsEnabled() &&
|
|
nsHTMLMediaElement::IsMediaPluginsType(nsDependentCString(aType))) {
|
|
docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
|
if (docFactory && aLoaderType) {
|
|
*aLoaderType = TYPE_CONTENT;
|
|
}
|
|
return docFactory.forget();
|
|
}
|
|
#endif // MOZ_MEDIA_PLUGINS
|
|
-
|
|
#endif // MOZ_MEDIA
|
|
|
|
return NULL;
|
|
}
|
|
|
|
// static
|
|
bool
|
|
nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
|
|
diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h
|
|
--- a/content/html/content/public/nsHTMLMediaElement.h
|
|
+++ b/content/html/content/public/nsHTMLMediaElement.h
|
|
@@ -303,17 +303,18 @@ public:
|
|
#ifdef MOZ_WEBM
|
|
static bool IsWebMEnabled();
|
|
static bool IsWebMType(const nsACString& aType);
|
|
static const char gWebMTypes[2][11];
|
|
static char const *const gWebMCodecs[4];
|
|
#endif
|
|
|
|
#ifdef MOZ_GSTREAMER
|
|
- static bool IsH264Enabled();
|
|
+ static bool IsGStreamerEnabled();
|
|
+ static bool IsGStreamerSupportedType(const nsACString& aType);
|
|
static bool IsH264Type(const nsACString& aType);
|
|
static const char gH264Types[3][16];
|
|
static char const *const gH264Codecs[7];
|
|
#endif
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
static bool IsOmxEnabled();
|
|
static bool IsOmxSupportedType(const nsACString& aType);
|
|
diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp
|
|
--- a/content/html/content/src/nsHTMLMediaElement.cpp
|
|
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
|
|
@@ -2148,34 +2148,29 @@ char const *const nsHTMLMediaElement::gH
|
|
#ifdef MOZ_GSTREAMER
|
|
const char nsHTMLMediaElement::gH264Types[3][16] = {
|
|
"video/mp4",
|
|
"video/3gpp",
|
|
"video/quicktime",
|
|
};
|
|
|
|
bool
|
|
-nsHTMLMediaElement::IsH264Enabled()
|
|
+nsHTMLMediaElement::IsGStreamerEnabled()
|
|
{
|
|
- return Preferences::GetBool("media.h264.enabled");
|
|
+ return Preferences::GetBool("media.gstreamer.enabled");
|
|
}
|
|
|
|
bool
|
|
nsHTMLMediaElement::IsH264Type(const nsACString& aType)
|
|
{
|
|
- if (!IsH264Enabled()) {
|
|
- return false;
|
|
- }
|
|
-
|
|
for (uint32_t i = 0; i < ArrayLength(gH264Types); ++i) {
|
|
if (aType.EqualsASCII(gH264Types[i])) {
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
return false;
|
|
}
|
|
#endif
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
const char nsHTMLMediaElement::gOmxTypes[5][16] = {
|
|
"audio/mpeg",
|
|
"audio/mp4",
|
|
@@ -2424,34 +2419,63 @@ nsHTMLMediaElement::CanPlayType(const ns
|
|
default:
|
|
case CANPLAY_MAYBE:
|
|
aResult.AssignLiteral("maybe");
|
|
break;
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
+#ifdef MOZ_GSTREAMER
|
|
+bool
|
|
+nsHTMLMediaElement::IsGStreamerSupportedType(const nsACString& aMimeType)
|
|
+{
|
|
+ if (!IsGStreamerEnabled())
|
|
+ return false;
|
|
+ if (IsH264Type(aMimeType))
|
|
+ return true;
|
|
+ if (!Preferences::GetBool("media.prefer-gstreamer", false))
|
|
+ return false;
|
|
+#ifdef MOZ_WEBM
|
|
+ if (IsWebMType(aMimeType))
|
|
+ return true;
|
|
+#endif
|
|
+#ifdef MOZ_OGG
|
|
+ if (IsOggType(aMimeType))
|
|
+ return true;
|
|
+#endif
|
|
+ return false;
|
|
+}
|
|
+#endif
|
|
+
|
|
already_AddRefed<nsMediaDecoder>
|
|
nsHTMLMediaElement::CreateDecoder(const nsACString& aType)
|
|
{
|
|
+#ifdef MOZ_GSTREAMER
|
|
+ // When enabled, use GStreamer for H.264, but not for codecs handled by our
|
|
+ // bundled decoders, unless the "media.prefer-gstreamer" pref is set.
|
|
+ if (IsGStreamerSupportedType(aType)) {
|
|
+ nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
|
|
+ if (decoder->Init(this)) {
|
|
+ return decoder.forget();
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
+
|
|
#ifdef MOZ_RAW
|
|
if (IsRawType(aType)) {
|
|
nsRefPtr<nsRawDecoder> decoder = new nsRawDecoder();
|
|
if (decoder->Init(this)) {
|
|
return decoder.forget();
|
|
}
|
|
}
|
|
#endif
|
|
#ifdef MOZ_OGG
|
|
if (IsOggType(aType)) {
|
|
-#ifdef MOZ_GSTREAMER
|
|
- nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
|
|
-#else
|
|
nsRefPtr<nsOggDecoder> decoder = new nsOggDecoder();
|
|
-#endif
|
|
if (decoder->Init(this)) {
|
|
return decoder.forget();
|
|
}
|
|
}
|
|
#endif
|
|
#ifdef MOZ_WAVE
|
|
if (IsWaveType(aType)) {
|
|
nsRefPtr<nsWaveDecoder> decoder = new nsWaveDecoder();
|
|
@@ -2473,44 +2497,32 @@ nsHTMLMediaElement::CreateDecoder(const
|
|
nsRefPtr<nsMediaPluginDecoder> decoder = new nsMediaPluginDecoder(aType);
|
|
if (decoder->Init(this)) {
|
|
return decoder.forget();
|
|
}
|
|
}
|
|
#endif
|
|
#ifdef MOZ_WEBM
|
|
if (IsWebMType(aType)) {
|
|
-#ifdef MOZ_GSTREAMER
|
|
- nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
|
|
-#else
|
|
nsRefPtr<nsWebMDecoder> decoder = new nsWebMDecoder();
|
|
-#endif
|
|
if (decoder->Init(this)) {
|
|
return decoder.forget();
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#ifdef MOZ_DASH
|
|
if (IsDASHMPDType(aType)) {
|
|
nsRefPtr<nsDASHDecoder> decoder = new nsDASHDecoder();
|
|
if (decoder->Init(this)) {
|
|
return decoder.forget();
|
|
}
|
|
}
|
|
#endif
|
|
|
|
-#ifdef MOZ_GSTREAMER
|
|
- if (IsH264Type(aType)) {
|
|
- nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
|
|
- if (decoder->Init(this)) {
|
|
- return decoder.forget();
|
|
- }
|
|
- }
|
|
-#endif
|
|
return nullptr;
|
|
}
|
|
|
|
nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
|
|
{
|
|
NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set");
|
|
NS_ASSERTION(mDecoder == nullptr, "Shouldn't have a decoder");
|
|
|
|
diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js
|
|
--- a/modules/libpref/src/init/all.js
|
|
+++ b/modules/libpref/src/init/all.js
|
|
@@ -164,17 +164,17 @@ pref("media.wave.enabled", true);
|
|
#endif
|
|
#ifdef MOZ_WEBM
|
|
pref("media.webm.enabled", true);
|
|
#endif
|
|
#ifdef MOZ_DASH
|
|
pref("media.dash.enabled", true);
|
|
#endif
|
|
#ifdef MOZ_GSTREAMER
|
|
-pref("media.h264.enabled", true);
|
|
+pref("media.gstreamer.enabled", true);
|
|
#endif
|
|
#ifdef MOZ_WEBRTC
|
|
pref("media.navigator.enabled", false);
|
|
pref("media.peerconnection.enabled", false);
|
|
pref("media.navigator.permission.disabled", false);
|
|
#else
|
|
#ifdef ANDROID
|
|
pref("media.navigator.enabled", true);
|