mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 22:05:58 +00:00
avviddec: Ensure drain even if codec has not delay capabilities
There are decoders that need to be drained if they work on multi-threads, even if AV_CODEC_CAP_DELAY is not set.
This commit is contained in:
parent
2b6e9d303d
commit
93e2466115
1 changed files with 8 additions and 17 deletions
|
@ -1729,28 +1729,19 @@ static GstFlowReturn
|
|||
gst_ffmpegviddec_drain (GstVideoDecoder * decoder)
|
||||
{
|
||||
GstFFMpegVidDec *ffmpegdec = (GstFFMpegVidDec *) decoder;
|
||||
GstFFMpegVidDecClass *oclass;
|
||||
GstFlowReturn ret;
|
||||
gboolean got_frame = FALSE;
|
||||
|
||||
if (!ffmpegdec->opened)
|
||||
return GST_FLOW_OK;
|
||||
|
||||
oclass = (GstFFMpegVidDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
||||
if (avcodec_send_packet (ffmpegdec->context, NULL))
|
||||
goto send_packet_failed;
|
||||
|
||||
if (oclass->in_plugin->capabilities & AV_CODEC_CAP_DELAY) {
|
||||
GstFlowReturn ret;
|
||||
gboolean got_frame = FALSE;
|
||||
|
||||
GST_LOG_OBJECT (ffmpegdec,
|
||||
"codec has delay capabilities, calling until ffmpeg has drained everything");
|
||||
|
||||
if (avcodec_send_packet (ffmpegdec->context, NULL))
|
||||
goto send_packet_failed;
|
||||
|
||||
do {
|
||||
got_frame = gst_ffmpegviddec_frame (ffmpegdec, NULL, &ret);
|
||||
} while (got_frame && ret == GST_FLOW_OK);
|
||||
avcodec_flush_buffers (ffmpegdec->context);
|
||||
}
|
||||
do {
|
||||
got_frame = gst_ffmpegviddec_frame (ffmpegdec, NULL, &ret);
|
||||
} while (got_frame && ret == GST_FLOW_OK);
|
||||
avcodec_flush_buffers (ffmpegdec->context);
|
||||
|
||||
done:
|
||||
return GST_FLOW_OK;
|
||||
|
|
Loading…
Reference in a new issue