From patchwork Tue Dec 6 14:36:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basel Sayeh X-Patchwork-Id: 39630 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp4201657pzb; Tue, 6 Dec 2022 06:36:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf5bxAMfhmUJTziQkIU1pX6SudWCeMzIaupAejAvbnFkefl3uy5Hie30yJb4TNKQpXZ7B8QL X-Received: by 2002:a17:906:a094:b0:7ad:88f8:761f with SMTP id q20-20020a170906a09400b007ad88f8761fmr69414109ejy.417.1670337411505; Tue, 06 Dec 2022 06:36:51 -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 bq1-20020a056402214100b0046ca1f7b96dsi1821806edb.587.2022.12.06.06.36.51; Tue, 06 Dec 2022 06:36:51 -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; dkim=neutral (body hash did not verify) header.i=@hotmail.com header.s=selector1 header.b=aZbzuUE9; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hotmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5ECE368BD26; Tue, 6 Dec 2022 16:36:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01olkn2016.outbound.protection.outlook.com [40.92.65.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 849CE68B5E3 for ; Tue, 6 Dec 2022 16:36:42 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LIGWIoz6uzgtZOFDfJBn/4J3f5hGuoApmUdDn38KbLGXbkZ6iCSPPIfon7lJ4Kaot6HTG/AEKh06W3FNiMIO/A0oJE+s1MPMfNPjMR1woPw5Qu7/cLAh+wfE+iopjc8Zvjpgni0NzFAatuPh/iPjQ3yrsQudl4Yi3SEeFTPUWc7tyDmIQL3pYk0qs7Qgegx+Y74QVCCoPpWiKeZLZIQiI9Ay/SwBEWzmREf4NGxhJa+kSqfeOsLKJNWD8qz32YQgLxUam7iTcyVEZN1co/DX0T7fzWX6Oq46vArBIcBtp2HSqx4IMOytxsMJCenMoTOD5ZalOeBcSRdQ91VI6B//7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZFNSDgzZWg+dJd8Qxd6+NbSGzpJKTytbC9U/1DdJB1g=; b=UvmYomnHoaWTPIEyzoP2eMkCLcNqCyO5cqngj6LZKE5cPYJAKmXC/K4qxAaM7z+olM/cmFpb2uC7NVWl34WhMq8p7h/aCR+TH4ajcV8v8fbGwdqjC+Zvg7YkOk0AeLBfq4DzBtKFx0N1P4dqzSPqvXtubN6AJ4O0Iuii+rBIjezlQKsjkXT6FrH0tQ4f3Iu0W/yPSNSZy7D5H5at3qes6MIIy6RuKCVhijCYHJxfafKSmlk9A99oJHl8thYnibeDD/JkCsbZgUmeBmZ8wJzndBJbmUjJ7OcSsn2CurK7R2G5DWZA04R2eFsd4Tg53tdQRCOyg1hosfuBpvjpbZAouw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZFNSDgzZWg+dJd8Qxd6+NbSGzpJKTytbC9U/1DdJB1g=; b=aZbzuUE99DBhKGh9W64UF3o9n7+cw72x5YcLhyS5YqckbTcAPZddDBR2WFkLYzNxot2REjz2drT40/ZRZkHD3hqdh0W1/EowGIPT19d0BR3ieOH1UxxTJol1jnQquc9hPU1a/+Vih28GvqMtaZR3yWSGs+/IH4jXLdAej2iC/WpCSVWgmc6wK3ttvMBDrgBPr9ZoHkmq5uvz65kjW87Yjw/uMwQNb0GiV831rJZ9yFHDSTPK7JQQg3R+I7zgb/fkGW/yreVuloMB/+9fAXG3ASLIK6v6Vk1LjA1JHZw3QM1DiHWVr8MkZugA1i8UNis+2uO/0GoiRo7EcAc4FJPZ+g== Received: from DB9P191MB1482.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:224::19) by VE1P191MB0829.EURP191.PROD.OUTLOOK.COM (2603:10a6:800:16f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Tue, 6 Dec 2022 14:36:40 +0000 Received: from DB9P191MB1482.EURP191.PROD.OUTLOOK.COM ([fe80::bada:6a73:3b1:7977]) by DB9P191MB1482.EURP191.PROD.OUTLOOK.COM ([fe80::bada:6a73:3b1:7977%9]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 14:36:40 +0000 From: Basel Sayeh To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Dec 2022 17:36:17 +0300 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-Unsent: 1 X-TMN: [g922v6vc7+k7pN7gXF6Bk9Qyx/M+l19SLIlSxbgid64jg2sp+Sz52f6xjpkxOsVe] X-ClientProxiedBy: DX1P273CA0016.AREP273.PROD.OUTLOOK.COM (2603:1086:300:21::21) To DB9P191MB1482.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:224::19) X-Microsoft-Original-Message-ID: <20221206143617.8749-1-basel.sayeh@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9P191MB1482:EE_|VE1P191MB0829:EE_ X-MS-Office365-Filtering-Correlation-Id: 45b6cb33-61f0-42d6-22cc-08dad7974981 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmqUg3BJhog8XM4UuEveNYIF+1MPuUUziwD50YGm4kTs9ZDi+Cf2shTsFefI3hOe9JMR+fIzFA3v5QeGLIvKPXni3dFCZHpcNm1Km8jCBbh3KO3jqmPd1bDyyG46snmZfwp2Bvlylpy5XuKXOKdqC074uHMOVq7td/9OWfoBLfBwcfooZhT6yn8heh5YhNZDmj+dKYX51+ImyyDaj5qKz0D8l4EZWLeXUgJV9kg0UGfgB3NhxaHMvhb7C4EwKx8IhkBxp9ZcelCYcCzKLy3Emu89qhTE5KxzErW9fHfPvkfBgnOFjxffD5kvPo3+8PNCDQnutX5aN0Zs0PkqUSxA8fSFPiuNk17P2GPP6CaqSroo7SSWYLA3iXglZMpzAPd60XcEDfa6dmW0qIxhCt9Eob/srBBaipGI/Fp7abOROXQ7w+WBPyo5EXO3VdG4LzJYLpgijEDtYD5L8jGDB5ZQsD4/oVRNQw0iTzgwgZjBI3fUxIZURAzdm75c6Q9j88iOLo8Gpq9LXOsnm7rTOReSUZxFn5Skt+RM80JoVZs3JprYsRI0ywtPKzBrfMLArWBAhBAL0kmPJ8AfCtBi7ZvRR68cDMQy4JVYAnRqLPYH1IhtqeAMFGKOMKd5M+VoU9HIYU7Tg1dP4DKRXv6U1IU5UNLCCafTuR98BuU81lgG+UX6ZwlWjgZhxnjNxdLCjfs2IN5/c3orYMn66E6xcRfkSXGSIyNgIXiU6ctSDQz424bOounfANAhAN8YG6Rxw9d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XIFF+e/g+TO7IGFyddpuINzvpP8wcBU5Q== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-50200.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 45b6cb33-61f0-42d6-22cc-08dad7974981 X-MS-Exchange-CrossTenant-AuthSource: DB9P191MB1482.EURP191.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 14:36:40.3016 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1P191MB0829 Subject: [FFmpeg-devel] [PATCH v5 2/2] libavformat/dashenc: Enable HTTP persistent connections for dashenc_delete_file X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Basel Sayeh Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: SkdYGcPkLyTH Signed-off-by: Basel Sayeh --- libavformat/dashenc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 9c1bcad9e3..ba0eb913a1 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -179,6 +179,7 @@ typedef struct DASHContext { int master_playlist_created; AVIOContext *mpd_out; AVIOContext *m3u8_out; + AVIOContext *http_delete; int streaming; int64_t timeout; int index_correction; @@ -642,6 +643,7 @@ static void dash_free(AVFormatContext *s) ff_format_io_close(s, &c->mpd_out); ff_format_io_close(s, &c->m3u8_out); + ff_format_io_close(s, &c->http_delete); } static void output_segment_list(OutputStream *os, AVIOContext *out, AVFormatContext *s, @@ -1855,18 +1857,22 @@ static void dashenc_delete_file(AVFormatContext *s, char *filename) { int http_base_proto = ff_is_http_proto(filename); if (http_base_proto) { - AVIOContext *out = NULL; AVDictionary *http_opts = NULL; set_http_options(&http_opts, c); av_dict_set(&http_opts, "method", "DELETE", 0); - if (dashenc_io_open(s, &out, filename, &http_opts) < 0) { + if (dashenc_io_open(s, &c->http_delete, filename, &http_opts) < 0) { av_log(s, AV_LOG_ERROR, "failed to delete %s\n", filename); + } else { + //Nothing to write + avio_flush(c->http_delete); + dashenc_io_close(s, &c->http_delete, filename); } - av_dict_free(&http_opts); - ff_format_io_close(s, &out); + + if (!c->http_persistent) + ff_format_io_close(s, &c->http_delete); } else { int res = ffurl_delete(filename); if (res < 0) {