Bug 1092096 - Separate MSE prefs for MP4 and WebM; r=cajbir

This commit is contained in:
Anthony Jones 2014-10-31 23:09:49 +13:00
parent d0ed43c651
commit 590adad85e
5 changed files with 21 additions and 18 deletions

View File

@ -63,21 +63,10 @@ static const unsigned int MAX_SOURCE_BUFFERS = 16;
namespace mozilla {
static const char* const gMediaSourceTypes[6] = {
// XXX: Disabled other temporarily on desktop to allow WebM testing. For now,
// set the developer-only media.mediasource.ignore_codecs pref to true to test
// other codecs, and expect things to be broken.
//
// Disabled WebM in favour of MP4 on Firefox OS.
#ifdef MOZ_GONK_MEDIACODEC
"video/mp4",
"audio/mp4",
#else
"video/webm",
"audio/webm",
#endif
#if 0
"audio/mpeg",
#endif
nullptr
};
@ -87,10 +76,6 @@ IsTypeSupported(const nsAString& aType)
if (aType.IsEmpty()) {
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
}
if (Preferences::GetBool("media.mediasource.ignore_codecs", false)) {
return NS_OK;
}
// TODO: Further restrict this to formats in the spec.
nsContentTypeParser parser(aType);
nsAutoString mimeType;
nsresult rv = parser.GetType(mimeType);
@ -100,6 +85,16 @@ IsTypeSupported(const nsAString& aType)
bool found = false;
for (uint32_t i = 0; gMediaSourceTypes[i]; ++i) {
if (mimeType.EqualsASCII(gMediaSourceTypes[i])) {
if ((mimeType.EqualsASCII("video/mp4") ||
mimeType.EqualsASCII("audio/mp4")) &&
!Preferences::GetBool("media.mediasource.mp4.enabled", false)) {
break;
}
if ((mimeType.EqualsASCII("video/webm") ||
mimeType.EqualsASCII("audio/webm")) &&
!Preferences::GetBool("media.mediasource.webm.enabled", false)) {
break;
}
found = true;
break;
}

View File

@ -49,7 +49,7 @@ function beginTest() {
var prefs = [
[ "media.mediasource.enabled", true ],
[ "media.mediasource.ignore_codecs", true ],
[ "media.mediasource.mp4.enabled", true ],
];
if (/Linux/.test(navigator.userAgent) ||

View File

@ -110,7 +110,7 @@ function beginTest() {
var prefs = [
[ "media.mediasource.enabled", true ],
[ "media.mediasource.ignore_codecs", true ],
[ "media.mediasource.mp4.enabled", true ],
];
if (/Linux/.test(navigator.userAgent) ||

View File

@ -84,7 +84,7 @@ function beginTest() {
var prefs = [
[ "media.mediasource.enabled", true ],
[ "media.mediasource.ignore_codecs", true ],
[ "media.mediasource.mp4.enabled", true ],
];
if (/Linux/.test(navigator.userAgent) ||

View File

@ -420,6 +420,14 @@ pref("media.mediasource.enabled", false);
pref("media.mediasource.enabled", true);
#endif
#ifdef MOZ_WIDGET_GONK
pref("media.mediasource.mp4.enabled", false);
pref("media.mediasource.webm.enabled", false);
#else
pref("media.mediasource.mp4.enabled", false);
pref("media.mediasource.webm.enabled", true);
#endif
#ifdef MOZ_WEBSPEECH
pref("media.webspeech.recognition.enable", false);
pref("media.webspeech.synth.enabled", false);