From patchwork Sun Sep 16 15:41:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artjom Vejsel X-Patchwork-Id: 10333 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp2675832jap; Sun, 16 Sep 2018 08:47:55 -0700 (PDT) X-Google-Smtp-Source: ANB0VdalMWPWgw1M1ReNYsFWfDhMy7y4aKkcEWlHMc5REiXh3WVO8dr+EvWMEGochl9bcIZxDRmu X-Received: by 2002:adf:8024:: with SMTP id 33-v6mr15633770wrk.16.1537112875481; Sun, 16 Sep 2018 08:47:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537112875; cv=none; d=google.com; s=arc-20160816; b=PuatvTCnmkssRcsacCKWZEHnUMO6gxJ1I7tG1tzpL6oGz0g+thHrYb8uOl9ewkf7Mg hirqs6CrifBJ0IOgRz2eTMjmkYQJw8PPWVq7QFf9Lh0O09L9zjnYcp4ScF9jj+8LFSGM vMS3ILrB4JZdislO42jWS6zntNcTZHT2a8VAQqnVlEYwZ7iQZc3hbICj895VEVGS31cZ 3NX6lCZMi/QFIlIT0BimDSOBPyy1ZJqLwvEKW5kNDNiIRc151nnbIwdvpmFtaAkOxSjb KM2uQlK4QwCzKxUrrkGLRTiXDQ2faPJ7VFB6iThLgnbpJaG/7ZtAOYzS5RAgi1d+iYNv L2+Q== 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:message-id:date:to:from:dkim-signature :delivered-to; bh=oERYAJ7hqog4DY+rjgd4NJtVIOi4fOBJo9IS5B6jVeI=; b=tVCv+ec95QlmjSmSkqVgI/t/DMcZJJn3iF1EwpAih34ZCSexX8TDem6syQ2QaE/NG2 d4qA1dPwg2WYz8lkv7p6u90bKtnOBYidnn/6j6bwKwNY096fyr6ROGAcAdNyrJjVFPEU 7JtyvdUmvug43as1ZfjaBIE/+bDUYm7wsMdqsjG7R3Ogtu0d+lCwpRtiREvZ3/i8BPPj SP+d1QIn1fgxOGRc5LkfpNd6xrh7hgiJcjx7EYgj5mToEalthnXf8rmKLhZvIpVO2BKX JAo85zibT4c1bEPnAcjusbdkfXrF/e/7pXPwGMNwmu7aBA4nIUdnTn520zmQLMBCfVcm Hn3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=fvw5NEYB; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g188-v6si4241717wma.92.2018.09.16.08.47.54; Sun, 16 Sep 2018 08:47:55 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=fvw5NEYB; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B08D568A24C; Sun, 16 Sep 2018 18:47:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 90F9868A1D1 for ; Sun, 16 Sep 2018 18:47:34 +0300 (EEST) Received: by mail-lj1-f195.google.com with SMTP id v26-v6so11110136ljj.3 for ; Sun, 16 Sep 2018 08:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=kJPN8/SrvcwstsPfSXYVne1Z8V5IFDSOPl5URyfcYwk=; b=fvw5NEYB4+vn6eEadf+JHO8DMV+DV2z1gZy/6Y/SdX6Ix7/SHhCxVJIw1Slf8UxWQn l3ZEPGnvmE/iggl/SjedfJSbuzMuPUd2AEtCNi6DWbpAGcp81iVQerzmSsu5YMcduRq+ /xwApy3NHBzOIAiAu69U9LM0TmQ/EO9R9+tkKp2UG8mPrszVFT76iqyVz/XxtrTPyEi7 4MWAakPqs2D8xNK81Dhn7RZJP5XDAl986gAFmcjRwiQAf19QeBGA3UG7vgxvP+XaSN7h B/4fVJYzFHRrbHl2QH1rAzEWcQUr4gBfXLhx/vMtkn2tZM+RjKnijIHdbTBtVU1E+Pum 5aMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kJPN8/SrvcwstsPfSXYVne1Z8V5IFDSOPl5URyfcYwk=; b=AAE1KBHjAHTxGYv41yZfwvBzUVgnmYDfTokvY52ZpLwIYDiF8N6WhabqssL2RzMkyU wIiyYr/R1apMdPlrzYFS5iSfgBWCnUtBcTbgvc/ievygXiVq7up7ezY0MPuuDh/Gi4ns ro/JTCjjWInN5pa6dQavohzS3f6fe/PV9owXTuuQPMbjYOBziAAWLkZOD6pBOyVAd/gz bcw7B+M7vAuomEOPF1r7H0j523F+zVUaQMSJD6o3QK8odAat8MyH41AosHYTD7eetyLO A3dTNPgdTA7CfD1PP13gitgwG+2emyAN91CHe34B72VODayhOtmnpKYU+wnM3acrGOjg kJBw== X-Gm-Message-State: APzg51CWU4ExBj9sgwJLFMVCguf+/4Gc3eFyYof7853cSXtPehtRFdSq V15hOZ2z6Scz7lrjTLMQgjQDtxIBCjU= X-Received: by 2002:a2e:934d:: with SMTP id m13-v6mr12455595ljh.45.1537112525897; Sun, 16 Sep 2018 08:42:05 -0700 (PDT) Received: from localhost.localdomain ([2a02:2168:8f9b:cd00:f2d5:bfff:fe68:68c0]) by smtp.gmail.com with ESMTPSA id o78-v6sm7654lff.36.2018.09.16.08.42.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Sep 2018 08:42:05 -0700 (PDT) From: Artjom Vejsel To: ffmpeg-devel@ffmpeg.org Date: Sun, 16 Sep 2018 18:41:54 +0300 Message-Id: <20180916154154.5526-1-akawolf0@gmail.com> X-Mailer: git-send-email 2.18.0 Subject: [FFmpeg-devel] [PATCH] http connect: retry five times before reporting about error 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: Artjom Vejsel MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Artjom Vejsel --- Hello. I've faced an error while playing when downloading just stopped. It can be even few times at one film. After digging into source I've finished with knowledge that HTTP connection made only once and if it was not successfull, HTTP interface just report with an error. I tried to change this behaviour to try few times and that solve my problem. libavformat/http.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index 4fdb2f13f2..9afa885423 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -259,11 +259,19 @@ redo: cur_auth_type = s->auth_state.auth_type; cur_proxy_auth_type = s->auth_state.auth_type; + attempts++; + location_changed = http_open_cnx_internal(h, options); - if (location_changed < 0) - goto fail; + if (location_changed < 0) { + if (attempts < 5) { + av_log(h, AV_LOG_ERROR, "Couldn't get HTTP resource, retrying...\n"); + if (s->hd) + ffurl_closep(&s->hd); + goto redo; + } else + goto fail; + } - attempts++; if (s->http_code == 401) { if ((cur_auth_type == HTTP_AUTH_NONE || s->auth_state.stale) && s->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) {