如何检测Android H.264硬件加速功能 [英] How to detect Android H.264 hardware acceleration capability

查看:328
本文介绍了如何检测Android H.264硬件加速功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管不是全部,但许多Android设备支持H.264视频编解码器的硬件加速,但不支持VP8/VP9编解码器的硬件加速.为了提供更高质量的用户体验,我们希望在可能的情况下选择经过硬件加速的编解码器.因此,希望对特定设备是否具有H.264硬件加速支持进行运行时检测,并以此为基础来设置SDP中用于WebRTC对等连接的会话协商的特定编解码器.也就是说,如果硬件支持H.264,则将其设置为优先级较高的编解码器,而不是VP8/VP9.任何对此的想法将不胜感激.

A large number, though not all, of Android devices support hardware acceleration of the H.264 video codec but not the VP8/VP9 codecs. To provide a higher quality user experience, we would like to select the codec that is hardware accelerated when possible. Hence, would like runtime detection of whether the specific device has H.264 hardware acceleration support or not and based on this will set the particular codecs that is used in the SDP for session negotiation of the webRTC peerconnection. I.e., if H.264 is supported with hardware then will set that as the higher priority codec as opposed to VP8/VP9. Any thoughts on this would be greatly appreciated.

推荐答案

使用 MediaCodecList API,以迭代可用的编码器和解码器.名称以OMX.google.开头的编码器是SW编解码器-可以或多或少地将任何其他编解码器视为HW编解码器.最简单的方法可能是使用findEncoderForFormat(和findDecoderForFormat)并查看其返回的名称.如果需要更多详细信息,可以手动遍历列表.

Use the MediaCodecList API to iterate over the available encoders and decoders. Encoders whose name start with OMX.google. are SW codecs - any other codec can more or less be assumed to be a HW codec. The easiest is probably to use findEncoderForFormat (and findDecoderForFormat) and see what name this returns. If you need more detail, you can iterate through the list manually.

这篇关于如何检测Android H.264硬件加速功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆