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: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/97>
This commit is contained in:
Sebastian Dröge 2020-09-30 16:13:28 +03:00
parent 72933810f5
commit 1d671c7b89
4 changed files with 26 additions and 2 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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;

View file

@ -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;
}