[FFmpeg-devel] vcodec_open2 error: Internal bug, should not have happened
听,天边的歌
76138202 at qq.com
Mon Jul 10 10:21:17 EEST 2023
I am trying to implement the OpenMax IL Video Decoder on ffmpeg. But I meet some problems. When I use the codec with ffmpeg on Chrome by force, it raised a error of bug
ffmpeg_video_decoder.cc(491)] avcodec_open2 error: Internal bug, should not have happened
I 'm not familiar with the version of ffmpeg in the last serveral years. My codec can run success when using
./ffmpeg -c:v h264_omxcodec -i test1.mp4 output_video.mp4
and I haven't find out how to enable logging of ffmpeg on Chrome(I don't know why av_log_set_callback() is useless when I used it),
so Is there anyone can give me some advices?
Thx a lot.
The FFCodec is used as following:
#define OFFSET(x) offsetof(OMXCodecDecoderContext, x)
#define VDE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVCodecHWConfigInternal *const omx_hw_configs[] = {
&(const AVCodecHWConfigInternal) {
.public = {
.pix_fmt = AV_PIX_FMT_NV12,
.methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC |
AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX,
.device_type = AV_HWDEVICE_TYPE_OMX,
},
.hwaccel = NULL,
},
NULL
};
static const AVOption ff_omxcodec_vdec_options[] = {
{ "delay_flush", "Delay flush until hw output buffers are returned to the decoder",
OFFSET(delay_flush), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VD },
{ NULL }
};
#define DECLARE_OMX_VCLASS(short_name) \
static const AVClass ff_##short_name##_omxcodec_dec_class = { \
.class_name = #short_name "_libomxh264", \
.item_name = av_default_item_name, \
.option = ff_omxcodec_vdec_options, \
.version = LIBAVUTIL_VERSION_INT, \
};
#define DECLARE_OMX_VDEC(short_name, full_name, codec_id, bsf) \
DECLARE_OMX_VCLASS(short_name) \
const FFCodec ff_ ## short_name ## _omx_decoder = { \
.p.name = #short_name "_omxcodec", \
CODEC_LONG_NAME(full_name " OpenMAX IL decoder"), \
.p.type = AVMEDIA_TYPE_VIDEO, \
.p.id = codec_id, \
.p.priv_class = &ff_##short_name##_omxcodec_dec_class, \
.priv_data_size = sizeof(OMXCodecDecoderContext), \
.init = omx_decode_init, \
FF_CODEC_DECODE_CB(omx_decode_frame), \
.close = omx_decode_end, \
.flush = omx_decode_flush, \
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING , \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_SETS_PKT_DTS, \
.bsfs = bsf, \
.p.wrapper_name = "omxcodec", \
};
DECLARE_OMX_VDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb")
DECLARE_OMX_VDEC(hevc, "H.265", AV_CODEC_ID_HEVC, "hevc_mp4toannexb")
DECLARE_OMX_VDEC(mpeg4, "MPEG-4", AV_CODEC_ID_MPEG4, NULL)
More information about the ffmpeg-devel
mailing list