[FFmpeg-devel] [PATCH] hlsenc: flush segments to guarantuee atomic single file hls
Daniel Oberhoff
danieloberhoff at googlemail.com
Mon Sep 2 12:18:23 EEST 2019
Hi all,
This makes sure segments published in the playlist of a single file hls recording are actually visible in the filesystem before the playlist entry. Otherwise there is a tiny race condition where a read to a piblished segment may fail.
from c309a535a865be70682885aa3b3bffcede41d85c Mon Sep 17 00:00:00 2001
From: Daniel Oberhoff <daniel at danieloberhoff.de>
Date: Wed, 16 Jan 2019 15:58:52 +0100
Subject: [PATCH] flush segments to guarantuee atomic single file hls
---
libavformat/hlsenc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index d7a4cd2cc4..b0e0ce2300 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -461,6 +461,7 @@ static int flush_dynbuf(VariantStream *vs, int *range_length)
*range_length = avio_close_dyn_buf(ctx->pb, &buffer);
ctx->pb = NULL;
avio_write(vs->out, buffer, *range_length);
+ avio_flush(vs->out);
av_free(buffer);
// re-open buffer
--
2.22.0
More information about the ffmpeg-devel
mailing list