Bug 1916508 - Align codec string checks in Web Codecs for h264. r=media-playback-reviewers,alwu

To be fixed in Bug 1880326 -- checking is to be lenient in HTMLMediaElement
code (that Web Codecs uses for now, for example, non-existent levels need to be
accepted), and strict in Web Codecs (non-existent levels rejected).

Differential Revision: https://phabricator.services.mozilla.com/D221049
This commit is contained in:
Paul Adenot 2024-09-17 16:42:29 +00:00
Родитель 48a729e150
Коммит 05dceccb45
1 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -215,8 +215,24 @@ static bool CanDecode(const Config& aConfig) {
if (!IsSupportedVideoCodec(param.mParsedCodec)) {
return false;
}
// TODO: Instead of calling CanHandleContainerType with the guessed the
// containers, DecoderTraits should provide an API to tell if a codec is
// TODO (1880326): code below is wrongly using the logic of HTMLMediaElement
// for determining if a codec can be played, and incorrect codec string for
// h264 are accepted for HTMLMediaElement for compat reasons. Perform stricter
// check here until we fix it for real.
if (IsH264CodecString(param.mParsedCodec)) {
uint8_t profile, constraint;
H264_LEVEL level;
bool supported =
ExtractH264CodecDetails(aConfig.mCodec, profile, constraint, level,
H264CodecStringStrictness::Strict);
if (!supported) {
return false;
}
}
// TODO (1880326): Instead of calling CanHandleContainerType with the guessed
// the containers, DecoderTraits should provide an API to tell if a codec is
// decodable or not.
for (const nsCString& mime : GuessMIMETypes(param)) {
if (Maybe<MediaContainerType> containerType =