diff options
author | Jeroen Vreeken <jeroen@vreeken.net> | 2019-07-11 16:36:22 +0200 |
---|---|---|
committer | Jeroen Vreeken <jeroen@vreeken.net> | 2019-07-11 16:36:22 +0200 |
commit | 31addeaac8841867008699478ef55e1c1b3d68a7 (patch) | |
tree | cd580c19b66ce62987ece8df5d2ba7384c329502 /dom | |
parent | 18f9b185b67120ba88f5e643b7413ca06c497383 (diff) | |
download | uxp-31addeaac8841867008699478ef55e1c1b3d68a7.tar.gz |
Make matroska mime type checking more consistent.
Diffstat (limited to 'dom')
-rw-r--r-- | dom/media/mediasource/ContainerParser.cpp | 2 | ||||
-rw-r--r-- | dom/media/mediasource/MediaSource.cpp | 3 | ||||
-rw-r--r-- | dom/media/mediasource/TrackBuffersManager.cpp | 1 | ||||
-rw-r--r-- | dom/media/webm/WebMDecoder.cpp | 9 |
4 files changed, 10 insertions, 5 deletions
diff --git a/dom/media/mediasource/ContainerParser.cpp b/dom/media/mediasource/ContainerParser.cpp index 46f2e9557c..b4dcfde8af 100644 --- a/dom/media/mediasource/ContainerParser.cpp +++ b/dom/media/mediasource/ContainerParser.cpp @@ -697,7 +697,7 @@ ContainerParser::CreateForMIMEType(const nsACString& aType) if (aType.LowerCaseEqualsLiteral("video/webm") || aType.LowerCaseEqualsLiteral("audio/webm")) { return new WebMContainerParser(aType); } - if (aType.LowerCaseEqualsLiteral("video/x-matroska")) { + if (aType.LowerCaseEqualsLiteral("video/x-matroska") || aType.LowerCaseEqualsLiteral("audio/x-matroska")) { return new WebMContainerParser(aType); } diff --git a/dom/media/mediasource/MediaSource.cpp b/dom/media/mediasource/MediaSource.cpp index a262ff52cd..1c276cdc16 100644 --- a/dom/media/mediasource/MediaSource.cpp +++ b/dom/media/mediasource/MediaSource.cpp @@ -118,7 +118,8 @@ MediaSource::IsTypeSupported(const nsAString& aType, DecoderDoctorDiagnostics* a } return NS_OK; } - if (mimeType.EqualsASCII("audio/webm")) { + if (mimeType.EqualsASCII("audio/webm") || + mimeType.EqualsASCII("audio/x-matroska")) { if (!(Preferences::GetBool("media.mediasource.webm.enabled", false) || Preferences::GetBool("media.mediasource.webm.audio.enabled", true))) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; diff --git a/dom/media/mediasource/TrackBuffersManager.cpp b/dom/media/mediasource/TrackBuffersManager.cpp index 3a6f2a5c85..21fb158b58 100644 --- a/dom/media/mediasource/TrackBuffersManager.cpp +++ b/dom/media/mediasource/TrackBuffersManager.cpp @@ -815,6 +815,7 @@ TrackBuffersManager::CreateDemuxerforMIMEType() if (mType.LowerCaseEqualsLiteral("video/webm") || mType.LowerCaseEqualsLiteral("video/x-matroska") || + mType.LowerCaseEqualsLiteral("audio/x-matroska") || mType.LowerCaseEqualsLiteral("audio/webm")) { mInputDemuxer = new WebMDemuxer(mCurrentInputBuffer, true /* IsMediaSource*/ ); return; diff --git a/dom/media/webm/WebMDecoder.cpp b/dom/media/webm/WebMDecoder.cpp index 37e1e4a33e..5cb943742f 100644 --- a/dom/media/webm/WebMDecoder.cpp +++ b/dom/media/webm/WebMDecoder.cpp @@ -41,8 +41,11 @@ WebMDecoder::CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs, } const bool isWebMAudio = aMIMETypeExcludingCodecs.EqualsASCII("audio/webm"); - const bool isWebMVideo = aMIMETypeExcludingCodecs.EqualsASCII("video/webm") || aMIMETypeExcludingCodecs.EqualsASCII("video/x-matroska") ; - if (!isWebMAudio && !isWebMVideo) { + const bool isWebMVideo = aMIMETypeExcludingCodecs.EqualsASCII("video/webm"); + const bool isMatroskaAudio = aMIMETypeExcludingCodecs.EqualsASCII("audio/x-matroska") ; + const bool isMatroskaVideo = aMIMETypeExcludingCodecs.EqualsASCII("video/x-matroska") ; + + if (!isWebMAudio && !isWebMVideo && !isMatroskaAudio && !isMatroskaVideo) { return false; } @@ -63,7 +66,7 @@ WebMDecoder::CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs, } // Note: Only accept VP8/VP9 in a video content type, not in an audio // content type. - if (isWebMVideo && + if ((isWebMVideo || isMatroskaVideo) && (codec.EqualsLiteral("vp8") || codec.EqualsLiteral("vp8.0") || codec.EqualsLiteral("vp9") || codec.EqualsLiteral("vp9.0"))) { |