Fallback to matching video decoder by MIME type.
This commit is contained in:
parent
9dc856202a
commit
fc1d60e65b
1 changed files with 7 additions and 0 deletions
|
@ -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!")
|
||||
|
|
Loading…
Add table
Reference in a new issue