From patchwork Fri Apr 24 11:09:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vectronic X-Patchwork-Id: 19213 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 73FA944AD3B for ; Fri, 24 Apr 2020 14:36:40 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4F9C968C0BB; Fri, 24 Apr 2020 14:36:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CE1B468BFC8 for ; Fri, 24 Apr 2020 14:36:33 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id b11so10373365wrs.6 for ; Fri, 24 Apr 2020 04:36:33 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=JW6LFfjpIwySkSGhJp9u9KKDBqsvmYRr22oYmx621Bc=; b=N8dZNtMVgSGCREStFI0JYA1bfF+ZxDLeoxF9J0xXQkRMmCOqK60GLgF9X+ImARlwhd NLHciOBQoAGMMjqCjFXP/aH7b1jCH+/HYScp/biVI60QElJWwa16hGphvt33qvK+kPUM pcXkKn+jXemIW/aQVzfnVUVCQJEyEzkRL51m350NcBcjx1pT5gFfP/Oml57+Q9Tc5tsJ twlFY07XhGfc12G+YA8EbRHUO2S+6d8s7hYYSlYcgcWf+hn3jdybW/spHY8jW12dF5yy pkgljEEJOyHPNlK8zR4D3Agi5BtwDpQSzoHgwA9AsLrNHe0rY1EU72+WhfUg1M7PKllh Jviw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=JW6LFfjpIwySkSGhJp9u9KKDBqsvmYRr22oYmx621Bc=; b=TKqCNRIBCLesnn8y0If/1A3giaYqXgvkfEWe0OBpGv0m8SEH0upH45ScxTYnv1JfbI AUwKMrI4OL0y4Vo0pevdpjJAUs0YzA+VTUbFet9V2G7ey4lR3tsXulQOVhBpeY/Y3j/5 PhfXlZZiEKoHZULt8C3ArAQAx2/ceI8Z1U+PmDk96B6D5av1ooZvNgK6Fw7fdXSfrdNV 5oGB5EQT1MlEH1hcVqDUzNI3zXWuCfdxwAQBGn5mQwuhXYnJKIkib/+UEe6xYI7H0B7n vAsa5yuse4yIB0pkM6lCTvpwMk3qLcLuBozKESJGHPCHjoBILIwQwXxeRy0ZdQLDWLzM kYPg== X-Gm-Message-State: AGi0PuYSy+Dk1YAlRE7rhAW+4QG11ZdA+bwK8fFP68zWh4U2AbLKy8Yr GwRXR/PjX5HsBVDh4QU3U/UV6kNlscU= X-Google-Smtp-Source: APiQypLAaR+cAQKt6KhiQyz31B+qjv+QHkYFYj28VT6xEhoyU0JDkhk+6jQX9SQAqQAMDl7JjQJavQ== X-Received: by 2002:adf:fe87:: with SMTP id l7mr11142669wrr.360.1587726626980; Fri, 24 Apr 2020 04:10:26 -0700 (PDT) Received: from localhost.localdomain (cpc76904-dals22-2-0-cust471.20-2.cable.virginm.net. [81.106.45.216]) by smtp.gmail.com with ESMTPSA id k6sm2556541wma.19.2020.04.24.04.10.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Apr 2020 04:10:26 -0700 (PDT) From: vectronic To: ffmpeg-devel@ffmpeg.org Date: Fri, 24 Apr 2020 12:09:13 +0100 Message-Id: <20200424110913.47435-2-hello.vectronic@gmail.com> X-Mailer: git-send-email 2.24.2 (Apple Git-127) In-Reply-To: <20200424110913.47435-1-hello.vectronic@gmail.com> References: <20200424110913.47435-1-hello.vectronic@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/1] avformat/http: handle SEEK_SET to filesize 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: vectronic Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" if whence == SEEK_SET and offset is filesize and is_streamable is false we can just return the filesize to prevent an HTTP 416 error Signed-off-by: vectronic --- libavformat/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/http.c b/libavformat/http.c index c9415578aa..1adcc6eb67 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -1719,7 +1719,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo int old_buf_size, ret; AVDictionary *options = NULL; - if (whence == AVSEEK_SIZE) + if ((whence == AVSEEK_SIZE) || (whence == SEEK_SET && h->is_streamed == 0 && off == s->filesize)) return s->filesize; else if (!force_reconnect && ((whence == SEEK_CUR && off == 0) ||