From 8f84e1befdc346d787f8423ef91c99062b6460d3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 14 Mar 2022 13:58:37 +0100 Subject: [PATCH] decoder/plugins/FfmpegIo: return AVERROR_EOF at end of file This part of the AVIOContext API is not documented :-( Closes https://github.com/MusicPlayerDaemon/MPD/issues/1448 --- NEWS | 1 + src/decoder/plugins/FfmpegIo.cxx | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index fb4591849..74c5de4e4 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ ver 0.23.6 (not yet released) * decoder + - ffmpeg: fix end-of-file check (update stuck at empty files) - opus: fix "readpicture" on Opus files * output - pipewire: fix crash bug if setting volume before playback starts diff --git a/src/decoder/plugins/FfmpegIo.cxx b/src/decoder/plugins/FfmpegIo.cxx index f505dbdec..9ce80f4b7 100644 --- a/src/decoder/plugins/FfmpegIo.cxx +++ b/src/decoder/plugins/FfmpegIo.cxx @@ -35,7 +35,11 @@ AvioStream::~AvioStream() inline int AvioStream::Read(void *dest, int size) { - return decoder_read(client, input, dest, size); + const auto nbytes = decoder_read(client, input, dest, size); + if (nbytes == 0) + return AVERROR_EOF; + + return nbytes; } inline int64_t