From 1d671c7b89989f94576590b118b68250d0c2931f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 30 Sep 2020 16:13:28 +0300 Subject: avauddec/audenc/videnc: Don't return GST_FLOW_EOS when draining Same behaviour as for avviddec now. FFmpeg will return AVERROR_EOF when it's completely drained but we should not return that here or otherwise upstream will receive EOS and not forward us more data. Part-of: --- ext/libav/gstavauddec.c | 8 ++++++++ ext/libav/gstavaudenc.c | 8 ++++++++ ext/libav/gstavviddec.c | 4 ++-- ext/libav/gstavvidenc.c | 8 ++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/libav/gstavauddec.c b/ext/libav/gstavauddec.c index ceaee12..91ee8e3 100644 --- a/ext/libav/gstavauddec.c +++ b/ext/libav/gstavauddec.c @@ -611,6 +611,14 @@ gst_ffmpegauddec_drain (GstFFMpegAudDec * ffmpegdec) } while (got_frame); avcodec_flush_buffers (ffmpegdec->context); + /* FFMpeg will return AVERROR_EOF if it's internal was fully drained + * then we are translating it to GST_FLOW_EOS. However, because this behavior + * is fully internal stuff of this implementation and gstaudiodecoder + * baseclass doesn't convert this GST_FLOW_EOS to GST_FLOW_OK, + * convert this flow returned here */ + if (ret == GST_FLOW_EOS) + ret = GST_FLOW_OK; + if (got_any_frames) { GstFlowReturn new_ret = gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (ffmpegdec), NULL, 1); diff --git a/ext/libav/gstavaudenc.c b/ext/libav/gstavaudenc.c index 078ab0b..cfd0300 100644 --- a/ext/libav/gstavaudenc.c +++ b/ext/libav/gstavaudenc.c @@ -606,6 +606,14 @@ gst_ffmpegaudenc_drain (GstFFMpegAudEnc * ffmpegaudenc) avcodec_flush_buffers (ffmpegaudenc->context); + /* FFMpeg will return AVERROR_EOF if it's internal was fully drained + * then we are translating it to GST_FLOW_EOS. However, because this behavior + * is fully internal stuff of this implementation and gstaudioencoder + * baseclass doesn't convert this GST_FLOW_EOS to GST_FLOW_OK, + * convert this flow returned here */ + if (ret == GST_FLOW_EOS) + ret = GST_FLOW_OK; + return ret; } diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index b21c231..9e57a0b 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -1826,9 +1826,9 @@ gst_ffmpegviddec_drain (GstVideoDecoder * decoder) /* FFMpeg will return AVERROR_EOF if it's internal was fully drained * then we are translating it to GST_FLOW_EOS. However, because this behavior - * is fullly internal stuff of this implementation and gstvideodecoer + * is fully internal stuff of this implementation and gstvideodecoder * baseclass doesn't convert this GST_FLOW_EOS to GST_FLOW_OK, - * convert this flow retturn by ourselves */ + * convert this flow returned here */ if (ret == GST_FLOW_EOS) ret = GST_FLOW_OK; diff --git a/ext/libav/gstavvidenc.c b/ext/libav/gstavvidenc.c index f454de1..ebc1a76 100644 --- a/ext/libav/gstavvidenc.c +++ b/ext/libav/gstavvidenc.c @@ -765,6 +765,14 @@ gst_ffmpegvidenc_flush_buffers (GstFFMpegVidEnc * ffmpegenc, gboolean send) } while (got_packet); done: + /* FFMpeg will return AVERROR_EOF if it's internal was fully drained + * then we are translating it to GST_FLOW_EOS. However, because this behavior + * is fully internal stuff of this implementation and gstvideoencoder + * baseclass doesn't convert this GST_FLOW_EOS to GST_FLOW_OK, + * convert this flow returned here */ + if (ret == GST_FLOW_EOS) + ret = GST_FLOW_OK; + return ret; } -- cgit v1.2.1