From 1c4487f11ad1f42d2061e001b9315a15833cb77a Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Sun, 9 Jul 2023 23:21:16 +0200 Subject: [PATCH] avprotocol: Return EOF when stream is out of data According to the ffmpeg documentation[1] the read_packet function should never return 0. ffmpegdata_peek returns 0 when the stream is EOF causing us to fail detecting EOF and never close the pipeline, continually spinning on more data. ffmpeg instead wants an AVERROR_EOF code for to signal EOF. Part-of: --- subprojects/gst-libav/ext/libav/gstavprotocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/gst-libav/ext/libav/gstavprotocol.c b/subprojects/gst-libav/ext/libav/gstavprotocol.c index 249b240642..e7c9e5c7c5 100644 --- a/subprojects/gst-libav/ext/libav/gstavprotocol.c +++ b/subprojects/gst-libav/ext/libav/gstavprotocol.c @@ -98,7 +98,7 @@ gst_ffmpegdata_read (void *priv_data, unsigned char *buf, int size) GST_DEBUG ("Returning %d bytes", res); - return res; + return res == 0 ? AVERROR_EOF : res; } static int