Skip to content

Commit

Permalink
添加默认支持OMX.google.xxx 编码器对H264的支持;
Browse files Browse the repository at this point in the history
1.0.6
  • Loading branch information
ShenBen committed Jan 7, 2022
1 parent 05661b6 commit edc1575
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ public class CustomHardwareVideoEncoderFactory implements VideoEncoderFactory {
private static final int QCOM_VP8_KEY_FRAME_INTERVAL_ANDROID_M_MS = 20000;
private static final int QCOM_VP8_KEY_FRAME_INTERVAL_ANDROID_N_MS = 15000;
/**
* 支持对OMX.google 的匹配 ,如:OMX.google.h264.encoder
* 主要是为了解决对华为手机的支持
* 华为海思:OMX.hisi.video.encoder.avc 进行H264编码有问题
* 默认支持对OMX.google.xxx 的匹配 ,如:OMX.google.h264.encoder
* 目前大部分手机都支持OMX.google.xxx ;
*/
static final String GOOGLE_PREFIX = "OMX.google.";

Expand Down Expand Up @@ -267,7 +266,7 @@ private boolean isHardwareSupportedInCurrentSdkH264(MediaCodecInfo info) {
boolean isSupported = (name.startsWith(QCOM_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) ||
// Exynos H264 encoder is supported in LOLLIPOP or later.
(name.startsWith(EXYNOS_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) ||
//解决华为手机使用海思(OMX.hisi.video.encoder.avc)无法正常编码的问题,使用OMX.google.h264.encoder
//目前大部分手机都支持OMX.google.xxx,添加默认支持
(name.startsWith(GOOGLE_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);
if (isSupported) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ default boolean isSupportedVp9(@NonNull MediaCodecInfo info) {
* 注意当前{@link android.os.Build.VERSION#SDK_INT} 是否支持
* {@link CustomHardwareVideoEncoderFactory#isHardwareSupportedInCurrentSdkH264(MediaCodecInfo)}
*
* 注意:华为手机海思(OMX.hisi.video.encoder.avc)尽量不要使用,H264编码有问题。
*
* @param info 编码器信息
* @return 是否支持H264
*/
Expand Down

0 comments on commit edc1575

Please sign in to comment.