]> git.sesse.net Git - ffmpeg/commitdiff
avformat/hlsenc: move the segment files handler close to before temp flags process
authorSteven Liu <lq@chinaffmpeg.org>
Sat, 4 Mar 2017 01:27:56 +0000 (09:27 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Sat, 4 Mar 2017 01:27:56 +0000 (09:27 +0800)
fix ticket: #6204

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
libavformat/hlsenc.c

index 9cf621125c7e6d9f0900ca608af724abbf913b48..b8122f1a37adb03cf6913421ea531dc1b30faa6b 100644 (file)
@@ -1329,13 +1329,14 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
         new_start_pos = avio_tell(hls->avf->pb);
         hls->size = new_start_pos - hls->start_pos;
 
+        ff_format_io_close(s, &oc->pb);
+        if (hls->vtt_avf) {
+            ff_format_io_close(s, &hls->vtt_avf->pb);
+        }
         if ((hls->flags & HLS_TEMP_FILE) && oc->filename[0]) {
             if (!(hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size <= 0))
                 if (hls->avf->oformat->priv_class && hls->avf->priv_data)
                     av_opt_set(hls->avf->priv_data, "mpegts_flags", "resend_headers", 0);
-            ff_format_io_close(s, &oc->pb);
-            if (hls->vtt_avf)
-                ff_format_io_close(s, &hls->vtt_avf->pb);
             hls_rename_temp_file(s, oc);
         }