Fallback to matching video decoder by MIME type.

This commit is contained in:
Nicholas Tinsley authored and Greyson Parrelli committed 2024-02-23 16:42:57 -05:00
1 parent 9dc856202a
commit fc1d60e65b
1 file changed
+7
@@ -39,6 +39,13 @@ object MediaCodecCompat {
} else {
findBackupDecoderForDolbyVision(inputFormat) ?: throw IOException("Can't create decoder for $mimeType!")
}
} else if (mimeType != null) {
try {
val decoder = MediaCodec.createDecoderByType(mimeType)
return Pair(decoder, inputFormat)
} catch (iae: IllegalArgumentException) {
throw IOException("Can't create decoder for $mimeType, which is not a valid MIME type.", iae)
}
}
throw IOException("Can't create decoder for $mimeType!")