summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2020-09-30 16:13:28 +0300
committerTim-Philipp Müller <tim@centricular.com>2020-10-14 11:41:04 +0100
commit9e28867e864044a746c3289bc1ee552e1e19bea7 (patch)
tree4cf8c4a0fc245f4f0300d1a5d2c5b70dcf19675c
parent747a0fb72cb59d7060147ea20108421fe2a22300 (diff)
downloadgst-libav-9e28867e864044a746c3289bc1ee552e1e19bea7.tar.gz
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/103>
-rw-r--r--ext/libav/gstavauddec.c8
-rw-r--r--ext/libav/gstavaudenc.c8
-rw-r--r--ext/libav/gstavviddec.c4
-rw-r--r--ext/libav/gstavvidenc.c8
4 files changed, 26 insertions, 2 deletions
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 c4c7aab..e58dbe4 100644
--- a/ext/libav/gstavaudenc.c
+++ b/ext/libav/gstavaudenc.c
@@ -605,6 +605,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 957fee5..f0a4342 100644
--- a/ext/libav/gstavviddec.c
+++ b/ext/libav/gstavviddec.c
@@ -1756,9 +1756,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 34eef90..c2e72f1 100644
--- a/ext/libav/gstavvidenc.c
+++ b/ext/libav/gstavvidenc.c
@@ -750,6 +750,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;
}