зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1564466 - Make MediaSource not call Preferences::GetBool off-main-thread. r=jya
Preferences::GetBool is not thread-safe, StaticPrefs are. Also StaticPrefs are nicer anyway. There's a lot of Preferences:: usage in dom/media which looks suspicious, though I don't know if all that runs on the main thread. Differential Revision: https://phabricator.services.mozilla.com/D38097 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
fb5a3200bf
Коммит
ec51c3a362
|
@ -18,7 +18,6 @@
|
|||
#include "SourceBufferList.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/HTMLMediaElement.h"
|
||||
|
@ -110,13 +109,13 @@ nsresult MediaSource::IsTypeSupported(const nsAString& aType,
|
|||
const MediaMIMEType& mimeType = containerType->Type();
|
||||
if (mimeType == MEDIAMIMETYPE("video/mp4") ||
|
||||
mimeType == MEDIAMIMETYPE("audio/mp4")) {
|
||||
if (!Preferences::GetBool("media.mediasource.mp4.enabled", false)) {
|
||||
if (!StaticPrefs::media_mediasource_mp4_enabled()) {
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
if (mimeType == MEDIAMIMETYPE("video/webm")) {
|
||||
if (!(Preferences::GetBool("media.mediasource.webm.enabled", false) ||
|
||||
if (!(StaticPrefs::media_mediasource_webm_enabled() ||
|
||||
StaticPrefs::media_media_capabilities_enabled() ||
|
||||
containerType->ExtendedType().Codecs().Contains(
|
||||
NS_LITERAL_STRING("vp8")) ||
|
||||
|
@ -131,8 +130,8 @@ nsresult MediaSource::IsTypeSupported(const nsAString& aType,
|
|||
return NS_OK;
|
||||
}
|
||||
if (mimeType == MEDIAMIMETYPE("audio/webm")) {
|
||||
if (!(Preferences::GetBool("media.mediasource.webm.enabled", false) ||
|
||||
Preferences::GetBool("media.mediasource.webm.audio.enabled", true))) {
|
||||
if (!(StaticPrefs::media_mediasource_webm_enabled() ||
|
||||
StaticPrefs::media_mediasource_webm_audio_enabled())) {
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -430,12 +429,14 @@ bool MediaSource::IsTypeSupported(const GlobalObject& aOwner,
|
|||
|
||||
/* static */
|
||||
bool MediaSource::Enabled(JSContext* cx, JSObject* aGlobal) {
|
||||
return Preferences::GetBool("media.mediasource.enabled");
|
||||
// FIXME(emilio): Looks like this should just use [Pref="..."] on the IDL.
|
||||
return StaticPrefs::media_mediasource_enabled();
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool MediaSource::ExperimentalEnabled(JSContext* cx, JSObject* aGlobal) {
|
||||
return Preferences::GetBool("media.mediasource.experimental.enabled");
|
||||
// FIXME(emilio): Looks like this should just use [Pref="..."] on the IDL.
|
||||
return StaticPrefs::media_mediasource_experimental_enabled();
|
||||
}
|
||||
|
||||
void MediaSource::SetLiveSeekableRange(double aStart, double aEnd,
|
||||
|
|
|
@ -5770,6 +5770,50 @@ VARCACHE_PREF(
|
|||
)
|
||||
#undef PREF_VALUE
|
||||
|
||||
// MediaSource
|
||||
|
||||
// Whether to enable MediaSource support.
|
||||
VARCACHE_PREF(
|
||||
Live,
|
||||
"media.mediasource.enabled",
|
||||
media_mediasource_enabled,
|
||||
RelaxedAtomicBool, true
|
||||
)
|
||||
|
||||
VARCACHE_PREF(
|
||||
Live,
|
||||
"media.mediasource.mp4.enabled",
|
||||
media_mediasource_mp4_enabled,
|
||||
RelaxedAtomicBool, true
|
||||
)
|
||||
|
||||
VARCACHE_PREF(
|
||||
Live,
|
||||
"media.mediasource.webm.enabled",
|
||||
media_mediasource_webm_enabled,
|
||||
RelaxedAtomicBool,
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID)
|
||||
false
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
)
|
||||
|
||||
VARCACHE_PREF(
|
||||
Live,
|
||||
"media.mediasource.webm.audio.enabled",
|
||||
media_mediasource_webm_audio_enabled,
|
||||
RelaxedAtomicBool, true
|
||||
)
|
||||
|
||||
// Whether to enable MediaSource v2 support.
|
||||
VARCACHE_PREF(
|
||||
Live,
|
||||
"media.mediasource.experimental.enabled",
|
||||
media_mediasource_experimental_enabled,
|
||||
RelaxedAtomicBool, false
|
||||
)
|
||||
|
||||
// VideoSink
|
||||
VARCACHE_PREF(
|
||||
Live,
|
||||
|
|
|
@ -411,21 +411,6 @@ pref("media.webvtt.pseudo.enabled", true);
|
|||
// WebVTT debug logging.
|
||||
pref("media.webvtt.debug.logging", false);
|
||||
|
||||
// Whether to enable MediaSource support.
|
||||
pref("media.mediasource.enabled", true);
|
||||
|
||||
pref("media.mediasource.mp4.enabled", true);
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID)
|
||||
pref("media.mediasource.webm.enabled", false);
|
||||
#else
|
||||
pref("media.mediasource.webm.enabled", true);
|
||||
#endif
|
||||
pref("media.mediasource.webm.audio.enabled", true);
|
||||
|
||||
// Whether to enable MediaSource v2 support.
|
||||
pref("media.mediasource.experimental.enabled", false);
|
||||
|
||||
pref("media.benchmark.vp9.threshold", 150);
|
||||
pref("media.benchmark.frames", 300);
|
||||
pref("media.benchmark.timeout", 1000);
|
||||
|
|
Загрузка…
Ссылка в новой задаче