From patchwork Fri Dec 29 23:41:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 7027 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.79.195 with SMTP id r64csp11059042jad; Fri, 29 Dec 2017 15:47:55 -0800 (PST) X-Google-Smtp-Source: ACJfBouA5Y6Eecy5I0X+xth//0pigXSKy67aYI7yrspDO7xM6Fd9KN0IrWid4JV3p0ZLcFTDyZyj X-Received: by 10.223.136.67 with SMTP id e3mr32456156wre.150.1514591275166; Fri, 29 Dec 2017 15:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514591275; cv=none; d=google.com; s=arc-20160816; b=0kz7gjVTXiRB/AH4YVZY61kVRAm10xhFCztMAU21YO81arYg2Wb+F6W7L5vyox5HN5 ko61/2R5IuMRNRoa2SIecmcTGbvIQDvHdOP2szgjzJx42jHN2d5FeU0/ghczW8O97P9M 0KS710fvK6XaJPXEwhai58SWQ+aZmSGz5T/R5a/4HXvZkez6Ghov2v4Xho/muRYMIAc1 vFzLhCymEvExss9msmA/BnHjIlBKY7tkW9Whq/8fxnpwKmKJzyMShyYkCEkRC4gBzuZD Dx0P/ejRu2bj88lKlNNQHy6siJ/UDT+OPY0K+iL2UPpPJYolyD+i01U6B3Uo7J2oTiy1 pHUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=tzRF5CzdoOiVVRFC72nMwfZ1JcHi1Ju6XgVbJmaOEDk=; b=y9NEkh4XF69iW+pyqMOj6OvJ792RdtDOMsDcgEzNLze08qsnPZPnxlxRneellJ8lrZ G/SAKEOBhKovHRLNjdi84DeC5q0ovEqdTcDZh2GOq5UFqpCknIO/mqr3qLnKEjLjE8DM wZPRgiR2IfHom9cpN9vISgcOfgzYkZ1VQGwGRgBId4MAHC3+W4hkWfycCGCzcOmWt2MY sxZ6a1MTFiQoFgGELQG/Zr8ap6VkJ9bHkgusm3tOIIC9+ksngYUQEDo6cW0cF6/VVvU7 yHJhQGp3ebYWtyMT/BX3o2BNc5VFY71fTvTvcngi3RtxP+h7SbQA2t8lWISKWHjDlGLx Vwlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@tmm1-net.20150623.gappssmtp.com header.s=20150623 header.b=QswQcIFF; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j127si16704479wma.83.2017.12.29.15.47.54; Fri, 29 Dec 2017 15:47:55 -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=@tmm1-net.20150623.gappssmtp.com header.s=20150623 header.b=QswQcIFF; 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 3C252689A6C; Sat, 30 Dec 2017 01:47:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 540066899DC for ; Sat, 30 Dec 2017 01:47:32 +0200 (EET) Received: by mail-pf0-f196.google.com with SMTP id d23so22601718pfe.9 for ; Fri, 29 Dec 2017 15:47:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tmm1-net.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=htdRDZP067dWGS/EPShpOAaob8b9/NpBSUtdxInOyCQ=; b=QswQcIFFrTQS0SlXGDsAaxv2/CWMezfh4oO0me8ltS7GY2p4HAP3PUE5XFu5Ujlq4n Nvl+FgWaPF75DmkCqf0tFCOCVqvXa/NnFmeGlGaO4L2VGU/KRKnvPUVfVLpqFkiuso9z 7RKVF3D7H2WtRI7TICL2Kn9eB7QIyriofgxH+JQcp+uKHUKLgm4QKvC5m57lbhZA/idE rXrdSmgK5q0wIfu+6/3HKirMokq2C1isHOTX5v3W3MFhNvni+YWsNQOCZ2nALu+ja2Up 8Zc79PgASwXsiN/ZztyZmLm2402uEmegvD5tzsdx9q2sMvP3S015xyVl9N8AmcbReWcv +btA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=htdRDZP067dWGS/EPShpOAaob8b9/NpBSUtdxInOyCQ=; b=NrUv/CEETC/FNtdiQjt7jNMs9QV1vttG+TuSLQApZ0vcdeQXxeH0N1Ihme9faZOAwA OhB8qTllYUIeBBkZodZJ6kkqJjIUPIlmHgmwiCdpSDR/bM97O0SlJn7/0/hzGMQfSpVo gg7/U0Z+XmO9sN7LnA3zxSP5LF4pNlYWg8nCFQ4T0mBxu2VrSM4osOI0o68WmAe7oNR8 Wqavaez3z1ReSgXmD2UrjEpDIhFdg9tEh1axdxv1zURkRFAlBUjnnNv6ev99JpCB0rT+ N65s8w5fAMSGcPw3uIkkRQ5ksr45pTnAuOK7MXNLLd+7k4/tP7CczOjRk7DjviSot0AG 2Tcg== X-Gm-Message-State: AKGB3mLgS5OBRde+VpUJvDshfEHWNDOrPatgAOAyHS13pfSqxFyTV5W3 EP1KWhuSGBPLT/97r8CAoE1KjopA X-Received: by 10.99.168.10 with SMTP id o10mr13971535pgf.153.1514590925843; Fri, 29 Dec 2017 15:42:05 -0800 (PST) Received: from localhost.localdomain (c-69-181-54-242.hsd1.ca.comcast.net. [69.181.54.242]) by smtp.gmail.com with ESMTPSA id m23sm6565161pgv.45.2017.12.29.15.42.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 15:42:05 -0800 (PST) From: Aman Gupta To: ffmpeg-devel@ffmpeg.org Date: Fri, 29 Dec 2017 15:41:58 -0800 Message-Id: <20171229234158.33456-2-ffmpeg@tmm1.net> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171229234158.33456-1-ffmpeg@tmm1.net> References: <20171229234158.33456-1-ffmpeg@tmm1.net> Subject: [FFmpeg-devel] [PATCH 2/2] avformat/hls: ignore http_persistent for segments requring crypto 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: anssi.hannula@iki.fi, Aman Gupta , george@nsup.org, kjeyapal@akamai.com, lq@chinaffmpeg.org MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Aman Gupta Encrypted HLS segments have regular http:// urls, but open_input() actually prefixes them with crypto+ before calling open_url(), so they end up using the crypto protocol and not the http protocol. This means invoking ff_http_do_new_request will fail, so we avoid calling it in the first place. After the previous commit, the failure results in a warning printed to the user. In earlier versions, the failure would cause a segfault. Signed-off-by: Aman Gupta --- libavformat/hls.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index dccc7c7dd2..d9f7c6de4d 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1479,7 +1479,7 @@ reload: seg = next_segment(v); if (c->http_multiple == 1 && !v->input_next_requested && - seg && av_strstart(seg->url, "http", NULL)) { + seg && seg->key_type == KEY_NONE && av_strstart(seg->url, "http", NULL)) { ret = open_input(c, v, seg, &v->input_next); if (ret < 0) { if (ff_check_interrupt(c->interrupt_callback)) @@ -1511,7 +1511,8 @@ reload: return ret; } - if (c->http_persistent && av_strstart(seg->url, "http", NULL)) { + if (c->http_persistent && + seg->key_type == KEY_NONE && av_strstart(seg->url, "http", NULL)) { v->input_read_done = 1; } else { ff_format_io_close(v->parent, &v->input);