-
Notifications
You must be signed in to change notification settings - Fork 566
Closed
Description
在三星A5 Android 5.1.1上面无法播放,翻了下源码发现是判断不支持hevc格式
看了一下获取设备支持格式的代码,貌似是有问题的
private fun getSupportType() {
try {
val numCodecs = MediaCodecList.getCodecCount()
for (i in 0 until numCodecs) {
val codecInfo = MediaCodecList.getCodecInfoAt(i)
if (!codecInfo.isEncoder) {
continue
}
val types = codecInfo.supportedTypes
for (j in types.indices) {
supportTypeMap[types[j].toLowerCase()] = true
}
}
ALog.i(TAG, "supportType=${supportTypeMap.keys}")
} catch (t: Throwable) {
ALog.e(TAG, "getSupportType $t")
}
}
if (!codecInfo.isEncoder) {
continue
}
这行代码的判断应该是有问题的吧,应该是判断如果是编码器 才执行continue,如果是解码器接着执行。我测试的三星A5这台设备就是没有h265对应的编码器所以导致格式判断不通过,但是设备是有h265对应的解码器的。所以放开格式判断之后是能正常播放的。
Metadata
Metadata
Assignees
Labels
No labels