diff options
author | Yeongjin Jeong <yeongjin.jeong@navercorp.com> | 2019-04-29 15:02:06 +0900 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2020-09-25 00:47:28 +0100 |
commit | 32c4386c8587b1007b6367bc0ddd2a675c3a1d93 (patch) | |
tree | d2d29e5f5b5edac84014bd068b3c4e6a99b8bed2 | |
parent | 090cfd40aad49ad645a9bf4bdd62e65b739c95f3 (diff) | |
download | gst-libav-32c4386c8587b1007b6367bc0ddd2a675c3a1d93.tar.gz |
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.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/91>
-rw-r--r-- | ext/libav/gstavviddec.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index b0f55f2..ea367b2 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -1739,28 +1739,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 (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; + 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; |