diff options
author | trav90 <travawine@palemoon.org> | 2018-10-21 10:14:54 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-10-21 10:14:54 -0500 |
commit | 23013dda60af6191467a46ce73f1382bf69af01e (patch) | |
tree | 851449e3e0adb7d64d671e1a5bd57755a392f671 /dom/media/VideoUtils.cpp | |
parent | 29f718ef78f1a25ca904c6438b59ffc8e365a750 (diff) | |
download | UXP-23013dda60af6191467a46ce73f1382bf69af01e.tar UXP-23013dda60af6191467a46ce73f1382bf69af01e.tar.gz UXP-23013dda60af6191467a46ce73f1382bf69af01e.tar.lz UXP-23013dda60af6191467a46ce73f1382bf69af01e.tar.xz UXP-23013dda60af6191467a46ce73f1382bf69af01e.zip |
Ensure we correctly parse the finalized codec string for av1
Diffstat (limited to 'dom/media/VideoUtils.cpp')
-rw-r--r-- | dom/media/VideoUtils.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp index 80d39a49f..c06ba9070 100644 --- a/dom/media/VideoUtils.cpp +++ b/dom/media/VideoUtils.cpp @@ -438,6 +438,16 @@ ParseMIMETypeString(const nsAString& aMIMEType, return ParseCodecsString(codecsStr, aOutCodecs); } +template <int N> +static bool +StartsWith(const nsACString& string, const char (&prefix)[N]) +{ + if (N - 1 > string.Length()) { + return false; + } + return memcmp(string.Data(), prefix, N - 1) == 0; +} + bool IsH264CodecString(const nsAString& aCodec) { @@ -474,20 +484,11 @@ IsVP9CodecString(const nsAString& aCodec) bool IsAV1CodecString(const nsAString& aCodec) { - return aCodec.EqualsLiteral("av1"); + return aCodec.EqualsLiteral("av1") || + StartsWith(NS_ConvertUTF16toUTF8(aCodec), "av01"); } #endif -template <int N> -static bool -StartsWith(const nsACString& string, const char (&prefix)[N]) -{ - if (N - 1 > string.Length()) { - return false; - } - return memcmp(string.Data(), prefix, N - 1) == 0; -} - UniquePtr<TrackInfo> CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType) { |