avviddec: Fix how we get back the codec frame

With the new copy_opaque system, the corresponding frame is stored in the
picture opaque ref.

This also handles the case where the "regular" opaque might be empty in the
case of "DECODE_ONLY" frames, since it that field is set in `get_buffer2()`
which might not be called for those frames

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6331>
This commit is contained in:
Edward Hervey 2024-03-08 10:53:16 +01:00 committed by GStreamer Marge Bot
parent 5132c679a7
commit 3f9665eed2

View file

@ -1881,11 +1881,20 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
/* get the output picture timing info again */
out_dframe = ffmpegdec->picture->opaque;
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT (60, 31, 100)
out_frame =
gst_video_codec_frame_ref (av_buffer_get_opaque (ffmpegdec->
picture->opaque_ref));
#else
g_assert (out_dframe);
out_frame = gst_video_codec_frame_ref (out_dframe->frame);
#endif
/* also give back a buffer allocated by the frame, if any */
gst_buffer_replace (&out_frame->output_buffer, out_dframe->buffer);
gst_buffer_replace (&out_dframe->buffer, NULL);
if (out_dframe) {
gst_buffer_replace (&out_frame->output_buffer, out_dframe->buffer);
gst_buffer_replace (&out_dframe->buffer, NULL);
}
/* Extract auxilliary info not stored in the main AVframe */
{