From patchwork Wed Mar 1 02:23:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 2706 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.149 with SMTP id x21csp1738173vsf; Tue, 28 Feb 2017 18:25:04 -0800 (PST) X-Received: by 10.223.175.81 with SMTP id z75mr4802344wrc.3.1488335104465; Tue, 28 Feb 2017 18:25:04 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 196si5063260wmg.65.2017.02.28.18.25.03; Tue, 28 Feb 2017 18:25:04 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EDF0268826B; Wed, 1 Mar 2017 04:24:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbg291.qq.com (smtpbg291.qq.com [113.108.11.223]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3D57D68825B for ; Wed, 1 Mar 2017 04:24:42 +0200 (EET) X-QQ-mid: bizesmtp4t1488335048tuz4iwzjs Received: from localhost (unknown [47.90.47.25]) by esmtp4.qq.com (ESMTP) with id ; Wed, 01 Mar 2017 10:24:03 +0800 (CST) X-QQ-SSF: 01100000002000F0F820B00A0000000 X-QQ-FEAT: /A5Igf99+LTBBbjmlI91K/9OOwX7R142GS4s3ugfzY42/onqyrhRIZPOqsd/l +zkTAlOCaYlCeSoRXd3a5jVKpJEtp5rrGm5rm7rMtutxCZHnk1eXp8SGD+7tKDheTULAeEK se4ycI56JIa0hjWLDvQtQ+b8GN89H8GznUdd5IE5Bw9gxV1myxnZcPVOT+cdwDYF/8G2HAc WRd09xE+4sDI9KCbQd1qGX8Xh4LOaSBhfkHhZxJYMD+LSBTQGKg8P2G+U1BEuDCW1g2eFoS 2pWg== X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Wed, 1 Mar 2017 10:23:50 +0800 Message-Id: <20170301022350.20053-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.10.1.382.ga23ca1b.dirty X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH] avformat/hlsenc: move the segment files handle close before temp flags process X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" fix ticket: #6204 Signed-off-by: Steven Liu --- libavformat/hlsenc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 9cf6211..b8122f1 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -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); }