gpt4 book ai didi

Exception: Failed to find matching codec OMX.google.h264.decoder, error 0x80000000(异常:找不到匹配的编解码器OMX.google.h264.decder,错误0x80000000)

转载 作者:bug小助手 更新时间:2023-10-28 20:35:57 36 4
gpt4 key购买 nike



I wonder what are the possible causes for this exception.

我想知道这一例外的可能原因是什么。


Stack trace: java.io.IOException: Failed to find matching codec OMX.google.h264.decoder, error 0x80000000
at android.media.MediaCodec.native_setup(MediaCodec.java)
at android.media.MediaCodec.<init>(MediaCodec.java:1912)
at android.media.MediaCodec.createByCodecName(MediaCodec.java:1890)

The app actually searches the codec list and ensures OMX.google.h264.decoder exists before trying to use it.

这款应用程序实际上会搜索编解码器列表,并在尝试使用之前确保OMX.google.h264.deder存在。


if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
MediaCodecList mRegularCodecs = new MediaCodecList(MediaCodecList.ALL_CODECS);
for (MediaCodecInfo mci : mRegularCodecs.getCodecInfos()) {
if (mci.getName().contains("OMX.google.h264.decoder")) {
try {
MediaCodec mc = MediaCodec.createByCodecName("OMX.google.h264.decoder");
} catch (Exception ex) {
//log mci.getName() to show it is indeed "OMX.google.h264.decoder"
}
} else {
//do nothing
}
}
}

This works fine usually. The exception is rare. Could anyone shed some light on this? Could this be a temporary glitch of the OS and the app should keep trying?

这通常工作得很好。这种情况很少见。有谁能解释一下这件事吗?这会不会是操作系统的暂时故障,应用程序应该继续尝试?


更多回答
优秀答案推荐

Even if a specific codec exists on the device it's not guaranteed to always be available.

即使设备上存在特定的编解码器,也不能保证它始终可用。


Here are a couple of reasons for it not being available:

以下是它不可用的几个原因:



Considering this my recommendation is:

有鉴于此,我的建议是:



  1. Do not depend on a hardcoded type of codec but rather use whatever codec supports your given video format (see https://developer.android.com/reference/android/media/MediaCodecInfo.CodecCapabilities#isFormatSupported(android.media.MediaFormat) for example)

  2. For many popular formats there are more than one codec types. If you fail to create / configure one type of codec try to move on to another type that supports your format.

  3. Be ready to handle the situation when no codec is available at the moment.


更多回答

Thank you for the elucidating answer. I think the memory issue could be the culprit. I will try to track the memory situation. The app allows an unlimited number of video streams in theory. We have tested up to 16 concurrent video streams using the same codec without any problems normally.

谢谢你的澄清回答。我认为记忆问题可能是罪魁祸首。我会试着追踪记忆的情况。理论上,这款应用允许无限数量的视频流。我们使用相同的编解码器测试了多达16个并发视频流,正常情况下没有任何问题。

Video resolution is a major factor too. A 4K video uses roughly 4 times more memory than a full HD one. So many devices will start running out of memory after just 4 codec instances with 4K.

视频分辨率也是一个主要因素。4K视频的内存使用量大约是全高清视频的4倍。如此多的设备将在4K编解码器实例后开始耗尽内存。

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com