avviddec: decoder not working if ffmpeg recycle the same frame
I'm trying to make the avdec_cdgraphics
element working with GStreamer but I'm hitting a problem with avviddec
's current design.
As you can see in https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/cdgraphics.c#L79 the ffmpeg decoder is allocating a single output frame and is recycling it. As a result gst_ffmpegviddec_get_buffer2
is only called once and so the output dframe (ffmpegdec->picture->opaque
) is never updated (see https://gitlab.freedesktop.org/gstreamer/gst-libav/blob/master/ext/libav/gstavviddec.c#L755) resulting in all the output buffers having the same ts (0).
I have an ugly hack forcing ffmpeg to always allocate new frame and which is the video is properly rendered.
I'm not really familiar with ffmpeg and gst-libav so would welcome some guidance about the proper way to fix this. The workflow and interactions with ffmpeg aren't trivial and I'm afraid to break something.