mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1928536 - part2 : revert workaround from bug 1928484
. r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D228388
This commit is contained in:
parent
5a91d1a6a3
commit
7e1a376bd5
@ -141,11 +141,6 @@
|
||||
#endif
|
||||
#include "xpcpublic.h"
|
||||
|
||||
// TODO : remove this workaround after enabling HEVC by default in bug 1928536.
|
||||
#ifdef MOZ_WMF
|
||||
# include "mozilla/EMEUtils.h"
|
||||
#endif
|
||||
|
||||
mozilla::LazyLogModule gMediaElementLog("HTMLMediaElement");
|
||||
mozilla::LazyLogModule gMediaElementEventsLog("HTMLMediaElementEvents");
|
||||
|
||||
@ -5101,24 +5096,7 @@ CanPlayStatus HTMLMediaElement::GetCanPlay(
|
||||
|
||||
void HTMLMediaElement::CanPlayType(const nsAString& aType, nsAString& aResult) {
|
||||
DecoderDoctorDiagnostics diagnostics;
|
||||
CanPlayStatus canPlay;
|
||||
#ifdef MOZ_WMF
|
||||
// TODO : remove this workaround after enabling HEVC by default in bug
|
||||
// 1928536.
|
||||
bool isHEVC = false;
|
||||
Maybe<MediaContainerType> containerType = MakeMediaContainerType(aType);
|
||||
if (containerType) {
|
||||
const auto& codecString = containerType->ExtendedType().Codecs().AsString();
|
||||
isHEVC = StringBeginsWith(codecString, u"hev1"_ns) ||
|
||||
StringBeginsWith(codecString, u"hvc1"_ns);
|
||||
}
|
||||
if (isHEVC && !IsHEVCAllowedByOrigin(GetOrigin(OwnerDoc()))) {
|
||||
canPlay = CANPLAY_NO;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
canPlay = GetCanPlay(aType, &diagnostics);
|
||||
}
|
||||
CanPlayStatus canPlay = GetCanPlay(aType, &diagnostics);
|
||||
diagnostics.StoreFormatDiagnostics(OwnerDoc(), aType, canPlay != CANPLAY_NO,
|
||||
__func__);
|
||||
switch (canPlay) {
|
||||
|
@ -277,29 +277,4 @@ Maybe<nsCString> GetOrigin(const dom::Document* aDocument) {
|
||||
return Some(origin);
|
||||
}
|
||||
|
||||
#ifdef MOZ_WMF
|
||||
bool IsHEVCAllowedByOrigin(const Maybe<nsCString>& aOrigin) {
|
||||
if (StaticPrefs::media_wmf_hevc_enabled() == 1) {
|
||||
return true;
|
||||
}
|
||||
if (!aOrigin) {
|
||||
return false;
|
||||
}
|
||||
// This should be the same as the list in IsMFCDMAllowedByOrigin.
|
||||
static nsTArray<nsCString> kAllowedOrigins({
|
||||
"https://www.netflix.com"_ns,
|
||||
});
|
||||
for (const auto& allowedOrigin : kAllowedOrigins) {
|
||||
if (FindInReadable(allowedOrigin, *aOrigin)) {
|
||||
EME_LOG("IsHEVCAllowedByOrigin, origin (%s) is ALLOWED to use HEVC",
|
||||
aOrigin->get());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
EME_LOG("IsHEVCAllowedByOrigin, origin (%s) is NOT ALLOWED to use HEVC",
|
||||
aOrigin->get());
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -113,11 +113,6 @@ void DeprecationWarningLog(const dom::Document* aDocument,
|
||||
|
||||
Maybe<nsCString> GetOrigin(const dom::Document* aDocument);
|
||||
|
||||
#ifdef MOZ_WMF
|
||||
// TODO : remove this workaround after enabling HEVC by default in bug 1928536.
|
||||
bool IsHEVCAllowedByOrigin(const Maybe<nsCString>& aOrigin);
|
||||
#endif
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // EME_LOG_H_
|
||||
|
@ -40,11 +40,6 @@
|
||||
# include "mozilla/java/HardwareCodecCapabilityUtilsWrappers.h"
|
||||
#endif
|
||||
|
||||
// TODO : remove this workaround after enabling HEVC by default in bug 1928536.
|
||||
#ifdef MOZ_WMF
|
||||
# include "mozilla/EMEUtils.h"
|
||||
#endif
|
||||
|
||||
struct JSContext;
|
||||
class JSObject;
|
||||
|
||||
@ -138,8 +133,7 @@ static void RecordTypeForTelemetry(const nsAString& aType,
|
||||
void MediaSource::IsTypeSupported(const nsAString& aType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics,
|
||||
ErrorResult& aRv,
|
||||
Maybe<bool> aShouldResistFingerprinting,
|
||||
Maybe<nsCString> aOrigin) {
|
||||
Maybe<bool> aShouldResistFingerprinting) {
|
||||
if (aType.IsEmpty()) {
|
||||
return aRv.ThrowTypeError("Empty type");
|
||||
}
|
||||
@ -163,17 +157,6 @@ void MediaSource::IsTypeSupported(const nsAString& aType,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_WMF
|
||||
// TODO : remove this workaround after enabling HEVC by default in bug
|
||||
// 1928536.
|
||||
const auto& codecString = containerType->ExtendedType().Codecs().AsString();
|
||||
const bool isHEVC = StringBeginsWith(codecString, u"hev1"_ns) ||
|
||||
StringBeginsWith(codecString, u"hvc1"_ns);
|
||||
if (isHEVC && !IsHEVCAllowedByOrigin(aOrigin)) {
|
||||
return aRv.ThrowNotSupportedError("Can't play type");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Now we know that this media type could be played.
|
||||
// MediaSource imposes extra restrictions, and some prefs.
|
||||
// Avoid leaking information about the fact that it's pref-disabled,
|
||||
@ -469,8 +452,7 @@ bool MediaSource::IsTypeSupported(const GlobalObject& aOwner,
|
||||
IsTypeSupported(
|
||||
aType, &diagnostics, rv,
|
||||
doc ? Some(doc->ShouldResistFingerprinting(RFPTarget::MediaCapabilities))
|
||||
: Nothing(),
|
||||
doc ? GetOrigin(doc) : Nothing());
|
||||
: Nothing());
|
||||
bool supported = !rv.Failed();
|
||||
RecordTypeForTelemetry(aType, window);
|
||||
diagnostics.StoreFormatDiagnostics(doc, aType, supported, __func__);
|
||||
|
@ -81,13 +81,10 @@ class MediaSource final : public DOMEventTargetHelper,
|
||||
|
||||
static bool IsTypeSupported(const GlobalObject&, const nsAString& aType);
|
||||
// Throws on aRv if not supported.
|
||||
// TODO : origin check should be removed after enabling HEVC by default in bug
|
||||
// 1928536.
|
||||
static void IsTypeSupported(const nsAString& aType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics,
|
||||
ErrorResult& aRv,
|
||||
Maybe<bool> aShouldResistFingerprinting,
|
||||
Maybe<nsCString> aOrigin = Nothing());
|
||||
Maybe<bool> aShouldResistFingerprinting);
|
||||
|
||||
IMPL_EVENT_HANDLER(sourceopen);
|
||||
IMPL_EVENT_HANDLER(sourceended);
|
||||
|
Loading…
Reference in New Issue
Block a user