From ab800164429b40a333967db5edcd21bc0eb29590 Mon Sep 17 00:00:00 2001 From: shindli Date: Wed, 10 Apr 2019 06:35:39 +0300 Subject: [PATCH] Backed out changeset e80a847a8b9b (bug 1533129) for causing perma mda failures in dom/media/mediasource/test/test_isTypeSupportedExtensions.html --HG-- extra : rebase_source : 434f35ad3363c0c59eea03858f045d122cc3f114 --- dom/media/MediaMIMETypes.cpp | 27 +--- dom/media/MediaMIMETypes.h | 14 +- dom/media/mediasource/MediaSource.cpp | 50 ------- .../test/file_isTypeSupported.html | 17 --- dom/media/mediasource/test/mochitest.ini | 2 - .../test/test_isTypeSupportedExtensions.html | 136 ------------------ 6 files changed, 6 insertions(+), 240 deletions(-) delete mode 100644 dom/media/mediasource/test/file_isTypeSupported.html delete mode 100644 dom/media/mediasource/test/test_isTypeSupportedExtensions.html diff --git a/dom/media/MediaMIMETypes.cpp b/dom/media/MediaMIMETypes.cpp index 6039261f7c6e..d87caffbf5da 100644 --- a/dom/media/MediaMIMETypes.cpp +++ b/dom/media/MediaMIMETypes.cpp @@ -116,7 +116,7 @@ static int32_t GetParameterAsNumber(const nsContentTypeParser& aParser, MediaExtendedMIMEType::MediaExtendedMIMEType( const nsACString& aOriginalString, const nsACString& aMIMEType, bool aHaveCodecs, const nsAString& aCodecs, int32_t aWidth, int32_t aHeight, - double aFramerate, int32_t aBitrate, EOTF aEOTF, int32_t aChannels) + double aFramerate, int32_t aBitrate) : mOriginalString(aOriginalString), mMIMEType(aMIMEType), mHaveCodecs(aHaveCodecs), @@ -124,8 +124,6 @@ MediaExtendedMIMEType::MediaExtendedMIMEType( mWidth(aWidth), mHeight(aHeight), mFramerate(aFramerate), - mEOTF(aEOTF), - mChannels(aChannels), mBitrate(aBitrate) {} MediaExtendedMIMEType::MediaExtendedMIMEType( @@ -183,18 +181,6 @@ Maybe MediaExtendedMIMEType::ComputeFractionalString( return Some(result); } -static EOTF GetParameterAsEOTF(const nsContentTypeParser& aParser) { - nsAutoString eotf; - nsresult rv = aParser.GetParameter("eotf", eotf); - if (NS_FAILED_impl(rv)) { - return EOTF::UNSPECIFIED; - } - if (eotf.LowerCaseEqualsASCII("bt709")) { - return EOTF::BT709; - } - return EOTF::NOT_SUPPORTED; -} - Maybe MakeMediaExtendedMIMEType(const nsAString& aType) { nsContentTypeParser parser(aType); nsAutoString mime; @@ -216,12 +202,10 @@ Maybe MakeMediaExtendedMIMEType(const nsAString& aType) { int32_t height = GetParameterAsNumber(parser, "height", -1); double framerate = GetParameterAsNumber(parser, "framerate", -1); int32_t bitrate = GetParameterAsNumber(parser, "bitrate", -1); - EOTF eotf = GetParameterAsEOTF(parser); - int32_t channels = GetParameterAsNumber(parser, "channels", -1); return Some(MediaExtendedMIMEType(NS_ConvertUTF16toUTF8(aType), mime8, haveCodecs, codecs, width, height, - framerate, bitrate, eotf, channels)); + framerate, bitrate)); } Maybe MakeMediaExtendedMIMEType( @@ -251,10 +235,9 @@ Maybe MakeMediaExtendedMIMEType( return Nothing(); } - return Some(MediaExtendedMIMEType(NS_ConvertUTF16toUTF8(aConfig.mContentType), - mime8, haveCodecs, codecs, aConfig.mWidth, - aConfig.mHeight, framerate.ref(), - aConfig.mBitrate, EOTF::UNSPECIFIED)); + return Some(MediaExtendedMIMEType( + NS_ConvertUTF16toUTF8(aConfig.mContentType), mime8, haveCodecs, codecs, + aConfig.mWidth, aConfig.mHeight, framerate.ref(), aConfig.mBitrate)); } Maybe MakeMediaExtendedMIMEType( diff --git a/dom/media/MediaMIMETypes.h b/dom/media/MediaMIMETypes.h index 25ed66a5aeec..d5c67e555f82 100644 --- a/dom/media/MediaMIMETypes.h +++ b/dom/media/MediaMIMETypes.h @@ -143,13 +143,6 @@ class MediaCodecs { nsString mCodecs; }; -// Electro-Optical Transfer Functions -enum class EOTF { - UNSPECIFIED = -1, - NOT_SUPPORTED = 0, - BT709 = 1, -}; - // Class containing pre-parsed media MIME type parameters, e.g.: // MIME type/subtype, optional codecs, etc. class MediaExtendedMIMEType { @@ -172,9 +165,6 @@ class MediaExtendedMIMEType { Maybe GetBitrate() const { return GetMaybeNumber(mBitrate); } Maybe GetChannels() const { return GetMaybeNumber(mChannels); } Maybe GetSamplerate() const { return GetMaybeNumber(mSamplerate); } - Maybe GetEOTF() const { - return (mEOTF == EOTF::UNSPECIFIED) ? Nothing() : Some(mEOTF); - } // Original string. Note that "type/subtype" may not be lowercase, // use Type().AsString() instead to get the normalized "type/subtype". @@ -197,8 +187,7 @@ class MediaExtendedMIMEType { MediaExtendedMIMEType(const nsACString& aOriginalString, const nsACString& aMIMEType, bool aHaveCodecs, const nsAString& aCodecs, int32_t aWidth, - int32_t aHeight, double aFramerate, int32_t aBitrate, - EOTF aEOTF = EOTF::UNSPECIFIED, int32_t aChannels = -1); + int32_t aHeight, double aFramerate, int32_t aBitrate); MediaExtendedMIMEType(const nsACString& aOriginalString, const nsACString& aMIMEType, bool aHaveCodecs, const nsAString& aCodecs, int32_t aChannels, @@ -217,7 +206,6 @@ class MediaExtendedMIMEType { int32_t mWidth = -1; // -1 if not provided. int32_t mHeight = -1; // -1 if not provided. double mFramerate = -1; // -1 if not provided. - EOTF mEOTF = EOTF::UNSPECIFIED; // For audio int32_t mChannels = -1; // -1 if not provided. int32_t mSamplerate = -1; // -1 if not provided. diff --git a/dom/media/mediasource/MediaSource.cpp b/dom/media/mediasource/MediaSource.cpp index 672b256b71c0..702b51b6ec8b 100644 --- a/dom/media/mediasource/MediaSource.cpp +++ b/dom/media/mediasource/MediaSource.cpp @@ -361,62 +361,12 @@ void MediaSource::EndOfStream(const MediaResult& aError) { mDecoder->DecodeError(aError); } -static bool AreExtraParametersSane(const nsAString& aType) { - Maybe containerType = MakeMediaContainerType(aType); - if (!containerType) { - return false; - } - auto extendedType = containerType->ExtendedType(); - auto bitrate = extendedType.GetBitrate(); - if (bitrate && *bitrate > 10000000) { - return false; - } - if (containerType->Type().HasVideoMajorType()) { - auto width = extendedType.GetWidth(); - if (width && *width > MAX_VIDEO_WIDTH) { - return false; - } - auto height = extendedType.GetHeight(); - if (height && *height > MAX_VIDEO_HEIGHT) { - return false; - } - auto framerate = extendedType.GetFramerate(); - if (framerate && *framerate > 1000) { - return false; - } - auto eotf = extendedType.GetEOTF(); - if (eotf && *eotf == EOTF::NOT_SUPPORTED) { - return false; - } - } else if (containerType->Type().HasAudioMajorType()) { - auto channels = extendedType.GetChannels(); - if (channels && *channels > 6) { - return false; - } - auto samplerate = extendedType.GetSamplerate(); - if (samplerate && *samplerate > 192000) { - return false; - } - } - return true; -} - -static bool IsYouTube(const GlobalObject& aOwner) { - nsCString domain; - return aOwner.GetSubjectPrincipal() && - NS_SUCCEEDED(aOwner.GetSubjectPrincipal()->GetBaseDomain(domain)) && - domain.EqualsLiteral("youtube.com"); -} - /* static */ bool MediaSource::IsTypeSupported(const GlobalObject& aOwner, const nsAString& aType) { MOZ_ASSERT(NS_IsMainThread()); DecoderDoctorDiagnostics diagnostics; nsresult rv = IsTypeSupported(aType, &diagnostics); - if (NS_SUCCEEDED(rv) && IsYouTube(aOwner) && !AreExtraParametersSane(aType)) { - rv = NS_ERROR_DOM_NOT_SUPPORTED_ERR; - } nsCOMPtr window = do_QueryInterface(aOwner.GetAsSupports()); diagnostics.StoreFormatDiagnostics(window ? window->GetExtantDoc() : nullptr, diff --git a/dom/media/mediasource/test/file_isTypeSupported.html b/dom/media/mediasource/test/file_isTypeSupported.html deleted file mode 100644 index edac66677190..000000000000 --- a/dom/media/mediasource/test/file_isTypeSupported.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - MSE: isTypeSupported extended mime extensions - - - - - diff --git a/dom/media/mediasource/test/mochitest.ini b/dom/media/mediasource/test/mochitest.ini index 0d4774141878..e3af7eb9c30e 100644 --- a/dom/media/mediasource/test/mochitest.ini +++ b/dom/media/mediasource/test/mochitest.ini @@ -49,7 +49,6 @@ support-files = tags_before_cluster.webm tags_before_cluster.webm^header^ 1516754.webm 1516754.webm^headers^ - file_isTypeSupported.html [test_AbortAfterPartialMediaSegment.html] [test_AppendPartialInitSegment.html] @@ -89,7 +88,6 @@ skip-if = android_version == '22' || toolkit == 'android' || (os == "win" && pro skip-if = android_version == '22' || toolkit == 'android' # bug 1341519, bug 1401090 [test_FrameSelection_mp4.html] skip-if = toolkit == 'android' || os == 'win' # Not supported on android, # bug 1487973 -[test_isTypeSupportedExtensions.html] [test_HaveMetadataUnbufferedSeek.html] skip-if = android_version == '22' || toolkit == 'android' # bug 1342247, bug 1401090 [test_HaveMetadataUnbufferedSeek_mp4.html] diff --git a/dom/media/mediasource/test/test_isTypeSupportedExtensions.html b/dom/media/mediasource/test/test_isTypeSupportedExtensions.html deleted file mode 100644 index 6950e2c48e28..000000000000 --- a/dom/media/mediasource/test/test_isTypeSupportedExtensions.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - MSE: isTypeSupported extended mime extensions - - - - -
-      
-      
-      
- -