mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 08:11:16 +00:00
decoder: output decoded frames only once.
Make sure to output the decoded picture, and push the associated GstVideoCodecFrame, only once. The frame fully represents what needs to be output, included for interlaced streams. Otherwise, the base GstVideoDecoder class would release the frame twice. Anyway, the general process is to output decoded frames only when they are complete. By complete, we mean a full frame was decoded or both fields of a frame were decoded.
This commit is contained in:
parent
8bdef56cd4
commit
f040f4f8b4
1 changed files with 19 additions and 4 deletions
|
@ -294,6 +294,17 @@ gst_vaapi_picture_decode (GstVaapiPicture * picture)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Mark picture as output for internal purposes only. Don't push frame out */
|
||||
static void
|
||||
do_output_internal (GstVaapiPicture * picture)
|
||||
{
|
||||
if (GST_VAAPI_PICTURE_IS_OUTPUT (picture))
|
||||
return;
|
||||
|
||||
gst_video_codec_frame_clear (&picture->frame);
|
||||
GST_VAAPI_PICTURE_FLAG_SET (picture, GST_VAAPI_PICTURE_FLAG_OUTPUT);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
do_output (GstVaapiPicture * picture)
|
||||
{
|
||||
|
@ -350,10 +361,14 @@ gst_vaapi_picture_output (GstVaapiPicture * picture)
|
|||
break;
|
||||
if (!GST_VAAPI_PICTURE_IS_FIRST_FIELD (parent_picture))
|
||||
break;
|
||||
GST_VAAPI_PICTURE_FLAG_SET (parent_picture,
|
||||
GST_VAAPI_PICTURE_FLAG_SKIPPED);
|
||||
if (!do_output (parent_picture))
|
||||
return FALSE;
|
||||
if (parent_picture->frame == picture->frame)
|
||||
do_output_internal (parent_picture);
|
||||
else {
|
||||
GST_VAAPI_PICTURE_FLAG_SET (parent_picture,
|
||||
GST_VAAPI_PICTURE_FLAG_SKIPPED);
|
||||
if (!do_output (parent_picture))
|
||||
return FALSE;
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
return do_output (picture);
|
||||
|
|
Loading…
Reference in a new issue