Bug 1409664 - P15. Fix canPlayType so that it checks codecs if provided. r=bryce

Summary:
For flac, mp3 and adts, if a codec was provided but wasn't supported in the container, it would have reported Maybe instead of No

Depends on D1628

Tags: #secure-revision

Bug #: 1409664

Differential Revision: https://phabricator.services.mozilla.com/D1629
This commit is contained in:
Jean-Yves Avenard 2018-06-09 13:22:39 +02:00
parent 88f93633b1
commit b763f84cf1

View File

@ -121,14 +121,29 @@ CanHandleCodecsType(const MediaContainerType& aType,
return CANPLAY_NO;
}
#endif
if (MP3Decoder::IsSupportedType(aType)) {
return CANPLAY_YES;
if (MP3Decoder::IsSupportedType(mimeType)) {
if (MP3Decoder::IsSupportedType(aType)) {
return CANPLAY_YES;
}
// We can only reach this position if a particular codec was requested,
// mp3 is supported and working: the codec must be invalid.
return CANPLAY_NO;
}
if (ADTSDecoder::IsSupportedType(aType)) {
return CANPLAY_YES;
if (ADTSDecoder::IsSupportedType(mimeType)) {
if (ADTSDecoder::IsSupportedType(aType)) {
return CANPLAY_YES;
}
// We can only reach this position if a particular codec was requested,
// adts is supported and working: the codec must be invalid.
return CANPLAY_NO;
}
if (FlacDecoder::IsSupportedType(aType)) {
return CANPLAY_YES;
if (FlacDecoder::IsSupportedType(mimeType)) {
if (FlacDecoder::IsSupportedType(aType)) {
return CANPLAY_YES;
}
// We can only reach this position if a particular codec was requested,
// flac is supported and working: the codec must be invalid.
return CANPLAY_NO;
}
return CANPLAY_MAYBE;