[FFmpeg-devel,1/1] flush segments to guarantuee atomic single file hls

Submitted by Daniel Oberhoff on Jan. 16, 2019, 3:03 p.m.

Details

Message ID 20190116150332.56301-2-daniel@danieloberhoff.de
State New
Headers show

Commit Message

Daniel Oberhoff Jan. 16, 2019, 3:03 p.m.
---
 libavformat/hlsenc.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Moritz Barsnick Jan. 19, 2019, 8:51 p.m.
> Subject: flush segments to guarantuee atomic single file hls
                             ^ nit no. 1: guarantee

Nit no. 2: Please use a commit line something like:

avformat/hlsenc: flush segments to guarantee atomic single file hls

(I'm not sure I agree with the wording, but I'm no HLS expert.)

Does this fix some known bug worth mentioning?

Moritz

Patch hide | download patch | download mbox

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index ca57694e9e..2cd651d7e8 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -406,6 +406,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