From 83373f786beb439b9a52675ed429bc8d059622df 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 cb607d3012..9498323754 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