Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vap android库 对设备是否支持h265的判断有问题 #230

Closed
gejiashu opened this issue May 18, 2022 · 2 comments
Closed

vap android库 对设备是否支持h265的判断有问题 #230

gejiashu opened this issue May 18, 2022 · 2 comments

Comments

@gejiashu
Copy link

gejiashu commented May 18, 2022

在三星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对应的解码器的。所以放开格式判断之后是能正常播放的。

@gejiashu
Copy link
Author

vap库应该只涉及到解码的 所以这里逻辑上是有问题的 应该只用判断支持的解码库就好了。

@hexleo
Copy link
Collaborator

hexleo commented May 18, 2022

感谢指出错误,这里我修复下。在2.0.25版本修复此问题

@hexleo hexleo closed this as completed in 68fd6af May 18, 2022
pianxian added a commit to pianxian/vap that referenced this issue Jul 25, 2022
* 'master' of https://github.com/Tencent/vap:
  feat: presentedFrames
  Update README.md
  bug: 修复hevc解码支持判断错误问题 close Tencent#230
  bugfix: 重写box解析部分
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants