Skip to content

Commit

Permalink
Bug 1092096 - Separate MSE prefs for MP4 and WebM on a CLOSED TREE. r…
Browse files Browse the repository at this point in the history
…=cajbir
  • Loading branch information
Anthony Jones committed Oct 31, 2014
1 parent f1620be commit 7d46c71
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
25 changes: 10 additions & 15 deletions dom/media/mediasource/MediaSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand All @@ -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);
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion dom/media/test/test_eme_canvas_blocked.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

var prefs = [
[ "media.mediasource.enabled", true ],
[ "media.mediasource.ignore_codecs", true ],
[ "media.mediasource.mp4.enabled", true ],
];

if (/Linux/.test(navigator.userAgent) ||
Expand Down
2 changes: 1 addition & 1 deletion dom/media/test/test_eme_playback.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@

var prefs = [
[ "media.mediasource.enabled", true ],
[ "media.mediasource.ignore_codecs", true ],
[ "media.mediasource.mp4.enabled", true ],
];

if (/Linux/.test(navigator.userAgent) ||
Expand Down
2 changes: 1 addition & 1 deletion dom/media/test/test_eme_stream_capture_blocked.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

var prefs = [
[ "media.mediasource.enabled", true ],
[ "media.mediasource.ignore_codecs", true ],
[ "media.mediasource.mp4.enabled", true ],
];

if (/Linux/.test(navigator.userAgent) ||
Expand Down
8 changes: 8 additions & 0 deletions modules/libpref/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7d46c71

Please sign in to comment.