From patchwork Sun Oct 29 11:08:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_Gro=C3=9Fe?= X-Patchwork-Id: 5739 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp1469547jah; Sun, 29 Oct 2017 04:08:26 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Tuqblso8umvzz66d/lTI+z5VT2OA+heYBv0xvMMul1U6+XzjZcjEfHVEFDVhuvhRWuxfak X-Received: by 10.223.189.134 with SMTP id l6mr5041876wrh.266.1509275306449; Sun, 29 Oct 2017 04:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509275306; cv=none; d=google.com; s=arc-20160816; b=QuI1TooVwaNDE37geDqHSqd3T0r0fypQO7PrJuKH8pw7gTqQY+gew1buoXkRhvDSu5 t3wRB3pewv992N3GKZ+qmZ4x0zf7dF1W8YJgV9l5OR/Z76zpLYxIRSBTC8oQUPBPkxpp 0Y46J4KiqY2fwESTb4wWVJ/iW9rtBzrYoorDmqsh1kqmo62UjZXHQjuP7OW1cEi1Ih+H sghjXM2E2xh0WUjqB7z1oeKdP+1HrcWmOAtzVtbsE1ilFB5lF4NRa8gqI1n6m5SQ+wLD toZzUqPMJ56wKVuFps9B5ARG0xkidSbMrMnaSMdDqtJ6m6icr8ctmBNsGdNu46gvOO7f eIHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to:arc-authentication-results; bh=EuRsY6sblVJNvzUyUyPuSuoxbsyLYsP2K6LUEqYQu1U=; b=hdGlFmEWZjYufLzPrCTrKfKD4Y+Q4lU2IN/9Rnpx9D+wMfRXqy2Qj0fEXrOjzHpN5F ZIdkezMBBrVU9ZelKMsoZIVf4H1knmTxUUQ5BG/368FjbCqG7NS+lA33pRmeOjy4/u8P lwv+aB/b9AixNZ9fz6/A6ja4ePtOO7M0CnyTIbiZPwsaT6juGSrr1TIhqa+Rmwqtjwzo KmHtUhXPYBQRgBzQk5ILABY1x2i+lS5rHfrDUu0VKsvmiKZkEmUomI4afDM9sFKZHe+E Y9To7cgZXkUpd9mL7gyscELJMCyMNHi9qUUwiXmFEDVrATDr/G8cl2XiKeo+Dr7IWdhI Antg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 203si1004855wmn.160.2017.10.29.04.08.25; Sun, 29 Oct 2017 04:08:26 -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; 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 64225689EAD; Sun, 29 Oct 2017 13:08:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from james.theweblords.de (james.theweblords.de [217.11.55.87]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A3821689E65 for ; Sun, 29 Oct 2017 13:08:08 +0200 (EET) Received: (qmail 20388 invoked by uid 210); 29 Oct 2017 11:08:17 -0000 X-Qmail-Scanner-Diagnostics: from x4d07d30c.dyn.telefonica.de (petronios@theweblords.de@x4d07d30c.dyn.telefonica.de) by james (envelope-from , uid 201) with qmail-scanner-2.10st (mhr: 1.0. spamassassin: 3.4.1. perlscan: 2.10st. Clear:RC:1(77.7.211.12):. Processed in 0.045308 secs); 29 Oct 2017 11:08:17 -0000 Received: from x4d07d30c.dyn.telefonica.de (HELO montepegro.fem.tu-ilmenau.de) (petronios@theweblords.de@77.7.211.12) by james.theweblords.de with ESMTPA; 29 Oct 2017 11:08:17 -0000 From: =?UTF-8?q?Peter=20Gro=C3=9Fe?= To: ffmpeg-devel@ffmpeg.org Date: Sun, 29 Oct 2017 12:08:05 +0100 Message-Id: <20171029110805.8193-1-pegro@friiks.de> X-Mailer: git-send-email 2.13.6 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] ffmpeg.c: fix calculation of input file duration in seek_to_start() 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: =?UTF-8?q?Peter=20Gro=C3=9Fe?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes looping files without audio or when using stream_copy, where ist->nb_samples is not set since no decoding is done. This fixes ticket #5719 and also fixes an endless loop with the sample in ticket #6139. Signed-off-by: Peter Große --- fftools/ffmpeg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index cabc6864e7..17b594bac8 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -4144,9 +4144,9 @@ static int seek_to_start(InputFile *ifile, AVFormatContext *is) continue; } else { if (ist->framerate.num) { - duration = av_rescale_q(1, ist->framerate, ist->st->time_base); + duration = av_rescale_q(1, av_inv_q(ist->framerate), ist->st->time_base); } else if (ist->st->avg_frame_rate.num) { - duration = av_rescale_q(1, ist->st->avg_frame_rate, ist->st->time_base); + duration = av_rescale_q(1, av_inv_q(ist->st->avg_frame_rate), ist->st->time_base); } else duration = 1; } if (!ifile->duration)