[FFmpeg-cvslog] avformat/hlsenc: Only write something if there is something to write
Andreas Rheinhardt
git at videolan.org
Thu Nov 18 07:27:13 EET 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Nov 9 22:21:37 2021 +0100| [96fe44e2e8e4c77e66cbb0834d340719741e964c] | committer: Andreas Rheinhardt
avformat/hlsenc: Only write something if there is something to write
This is especially important in case avio_write() would be switched
to an unsigned type like size_t, then a potential error from avio_read()
(with negative return value) would no longer be handled gracefully by
avio_write().
Reviewed-by: Steven Liu <lq at chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=96fe44e2e8e4c77e66cbb0834d340719741e964c
---
libavformat/hlsenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 557cf1bee3..cfd0c036d1 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2383,8 +2383,8 @@ static int64_t append_single_file(AVFormatContext *s, VariantStream *vs)
do {
read_byte = avio_read(vs->out, buf, BUFSIZE);
- avio_write(vs->out_single_file, buf, read_byte);
if (read_byte > 0) {
+ avio_write(vs->out_single_file, buf, read_byte);
total_size += read_byte;
ret = total_size;
}
More information about the ffmpeg-cvslog
mailing list