avviddec: Forward flow returns from draining instead of assuming OK

It might be useful for upstream to know that draining/finishing didn't
succeed, and why.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/90>
This commit is contained in:
Sebastian Dröge 2020-09-14 14:24:51 +03:00
parent c6e51f404d
commit 90a079cc8d

View file

@ -1810,7 +1810,7 @@ static GstFlowReturn
gst_ffmpegviddec_drain (GstVideoDecoder * decoder)
{
GstFFMpegVidDec *ffmpegdec = (GstFFMpegVidDec *) decoder;
GstFlowReturn ret;
GstFlowReturn ret = GST_FLOW_OK;
gboolean got_frame = FALSE;
if (!ffmpegdec->opened)
@ -1825,7 +1825,7 @@ gst_ffmpegviddec_drain (GstVideoDecoder * decoder)
avcodec_flush_buffers (ffmpegdec->context);
done:
return GST_FLOW_OK;
return ret;
send_packet_failed:
GST_WARNING_OBJECT (ffmpegdec, "send packet failed, could not drain decoder");
@ -2003,12 +2003,15 @@ gst_ffmpegviddec_stop (GstVideoDecoder * decoder)
static GstFlowReturn
gst_ffmpegviddec_finish (GstVideoDecoder * decoder)
{
gst_ffmpegviddec_drain (decoder);
GstFlowReturn flow_ret;
flow_ret = gst_ffmpegviddec_drain (decoder);
/* note that finish can and should clean up more drastically,
* but drain is also invoked on e.g. packet loss in GAP handling */
gst_ffmpegviddec_flush (decoder);
return GST_FLOW_OK;
return flow_ret;
}
static gboolean