diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-10-24 05:58:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-24 05:58:24 +0200 |
commit | d1a35c3fa6a59f622becc328bf00eff98732dc53 (patch) | |
tree | 6792772d3cb4e22e4bac907376ba17d3030bd008 /dom/media/VideoUtils.cpp | |
parent | 81acc4099a515cc1b74ec2b0669aa85fe078aabc (diff) | |
parent | 192199b03fa2e56d2728b0de1dbe4bedfc1edc50 (diff) | |
download | UXP-d1a35c3fa6a59f622becc328bf00eff98732dc53.tar UXP-d1a35c3fa6a59f622becc328bf00eff98732dc53.tar.gz UXP-d1a35c3fa6a59f622becc328bf00eff98732dc53.tar.lz UXP-d1a35c3fa6a59f622becc328bf00eff98732dc53.tar.xz UXP-d1a35c3fa6a59f622becc328bf00eff98732dc53.zip |
Merge pull request #850 from trav90/add-av1-support
Add initial support for AV1 video.
Diffstat (limited to 'dom/media/VideoUtils.cpp')
-rw-r--r-- | dom/media/VideoUtils.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp index b1a202c03..c06ba9070 100644 --- a/dom/media/VideoUtils.cpp +++ b/dom/media/VideoUtils.cpp @@ -207,8 +207,20 @@ already_AddRefed<SharedThreadPool> GetMediaThreadPool(MediaThreadType aType) name = "MediaPlayback"; break; } - return SharedThreadPool:: + RefPtr<SharedThreadPool> pool = SharedThreadPool:: Get(nsDependentCString(name), MediaPrefs::MediaThreadPoolDefaultCount()); + + // Ensure a larger stack for platform decoder threads + if (aType == MediaThreadType::PLATFORM_DECODER) { + const uint32_t minStackSize = 512*1024; + uint32_t stackSize; + MOZ_ALWAYS_SUCCEEDS(pool->GetThreadStackSize(&stackSize)); + if (stackSize < minStackSize) { + MOZ_ALWAYS_SUCCEEDS(pool->SetThreadStackSize(minStackSize)); + } + } + + return pool.forget(); } bool @@ -426,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) { @@ -458,15 +480,14 @@ IsVP9CodecString(const nsAString& aCodec) aCodec.EqualsLiteral("vp9.0"); } -template <int N> -static bool -StartsWith(const nsACString& string, const char (&prefix)[N]) +#ifdef MOZ_AV1 +bool +IsAV1CodecString(const nsAString& aCodec) { - if (N - 1 > string.Length()) { - return false; - } - return memcmp(string.Data(), prefix, N - 1) == 0; + return aCodec.EqualsLiteral("av1") || + StartsWith(NS_ConvertUTF16toUTF8(aCodec), "av01"); } +#endif UniquePtr<TrackInfo> CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType) |