From patchwork Thu Jan 19 02:20:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 2256 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp60614vsb; Wed, 18 Jan 2017 18:21:24 -0800 (PST) X-Received: by 10.223.130.118 with SMTP id 109mr6288884wrb.10.1484792484254; Wed, 18 Jan 2017 18:21:24 -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 b40si2541007wrb.87.2017.01.18.18.21.23; Wed, 18 Jan 2017 18:21:24 -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 8AB5268A571; Thu, 19 Jan 2017 04:21:10 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B75EB68A531 for ; Thu, 19 Jan 2017 04:21:02 +0200 (EET) X-QQ-mid: bizesmtp5t1484792440tmbzyikuw Received: from localhost (unknown [47.90.47.25]) by esmtp4.qq.com (ESMTP) with id ; Thu, 19 Jan 2017 10:20:40 +0800 (CST) X-QQ-SSF: 01100000002000F0F720000A0000000 X-QQ-FEAT: c1sy7WzK7UBLaaI5sTALyFsEa142J5FzwO4sB/BGHTijDHdnPjwujTcGwywIW jau28/B1//5Z3xfM92TCS9wfVjydf16QMAZ6EcoOuPWyeTc09coY+eh72Pc65c9/H/RMS3Y /5NECKQbCxJ8cobGLKzRSbFm6ug7MitC503L9hoxdZ22SwuOZP9deG05g9nF02eVJYTQK6/ LXAUAzbDExhYj3CKCI3324fwqXgXUhokaMLhi5suSfeis5BJLe/U5O1P4GCIIzfrMLWhPXB HdXA== X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Thu, 19 Jan 2017 10:20:38 +0800 Message-Id: <20170119022038.6909-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: fix too many open files bug 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" When use http method to delete the old segments, there is only io_open, hove not io_close yet, this patch is used to fix it Signed-off-by: Steven Liu --- libavformat/hlsenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 1f4bf8b..85d3955 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -300,6 +300,7 @@ static int hls_delete_old_segments(HLSContext *hls) { av_dict_set(&options, "method", "DELETE", 0); if ((ret = hls->avf->io_open(hls->avf, &out, path, AVIO_FLAG_WRITE, &options)) < 0) goto fail; + ff_format_io_close(hls->avf, &out); } else if (unlink(path) < 0) { av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n", path, strerror(errno)); @@ -322,6 +323,7 @@ static int hls_delete_old_segments(HLSContext *hls) { av_free(sub_path); goto fail; } + ff_format_io_close(hls->avf, &out); } else if (unlink(sub_path) < 0) { av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n", sub_path, strerror(errno));