From patchwork Thu Oct 26 16:32:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Peter_Gro=C3=9Fe?= X-Patchwork-Id: 5705 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp1013795jah; Thu, 26 Oct 2017 09:33:13 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QfSCGe4xUvxDqslFcrXKAVf78aVXTSkjCyZ/+4/3F0nB5OP2WnsKy1VGvTh6CQaentcjte X-Received: by 10.223.147.135 with SMTP id 7mr6109522wrp.237.1509035593657; Thu, 26 Oct 2017 09:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509035593; cv=none; d=google.com; s=arc-20160816; b=TLl+uWq50r83l4u6NiqJbid7MKGqrr/BhrXtMSl7QMksbMljgpEO0X0BYThqz1OFjc DSAsaqieuRj0FxfjDrn6qUXX+Mzf3COArNOgXVmaZi3rSQZq+NaBfdh2XRTTrXBkzcts ZgsGky2PG3bXiPTfyiWQzehKRMLyaZ5cmzVcNmY6VkRKDM3Q3IqMsMUxzTYc7zLSmXlM j9kAzQyuXmLB3oJqsw9xfNhib8DyPqjGqtGRPdRCHg4t6bPfFbgEo6NHBso28CzFNpv2 UxWl0oVMGjJT5/vwuVUujK1qValA7tUbHwEHtB73jfbavlMJJKZcMLAvf5oQqjc8SycV eChQ== 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:delivered-to :arc-authentication-results; bh=rQnTYAn0WyiJn4LJ1iGGPzeoiP9XLU7xI9LRMjLR0bQ=; b=uku+eiKUtLoKjCIH5N56fRJpJVHJUNXyBUe1fc+vyi7yERmPlp4W+febfBxLyktJay TH0c8hcnn4SHvD+SV3XnW7IiMko5ptDfCRaltJJEhU3YYsr9SUfw1EuTQo95X/qrnQCA OErwy3U7uNZU+G/qchT7+9WPcBXMj/CJcLzyz7EcwwRTDRRbE/bBYS5POViGmpI8YVQA yYedf580/gXD1RQ0Tz1JDwQghNXgvFwCIc9cXS+fEEJ26ekrYAcalGrOm/VlpZh0wv4z AWXG5gZhNl8zz/uCoUGqiMgKEYhAz9ZRdBjGD3m4+LOO7QFCD28NLTf+pC7zo13pJKXv H3XQ== 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 z143si1267481wmz.166.2017.10.26.09.33.13; Thu, 26 Oct 2017 09:33:13 -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 53C9368A661; Thu, 26 Oct 2017 19:33:04 +0300 (EEST) 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 8F4CD68A42E for ; Thu, 26 Oct 2017 19:32:57 +0300 (EEST) Received: (qmail 26169 invoked by uid 210); 26 Oct 2017 16:33:05 -0000 X-Qmail-Scanner-Diagnostics: from wl-r3-231.rz.tu-ilmenau.de (petronios@theweblords.de@wl-r3-231.rz.tu-ilmenau.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(141.24.16.231):. Processed in 0.04267 secs); 26 Oct 2017 16:33:05 -0000 Received: from wl-r3-231.rz.tu-ilmenau.de (HELO montepegro.fem.tu-ilmenau.de) (petronios@theweblords.de@141.24.16.231) by james.theweblords.de with ESMTPA; 26 Oct 2017 16:33:05 -0000 From: =?UTF-8?q?Peter=20Gro=C3=9Fe?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 26 Oct 2017 18:32:56 +0200 Message-Id: <20171026163256.19604-1-pegro@friiks.de> X-Mailer: git-send-email 2.13.6 Subject: [FFmpeg-devel] [PATCH 1/1] libavformat/mov.c: use calculated dts offset when seeking in streams 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: Jonas Licht MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Jonas Licht Subtract the calculated dts offset from the requested timestamp before seeking. This fixes an error "Error while filtering: Operation not permitted" observed with a short file which contains only one key frame and starts with negative timestamps. Then, av_index_search_timestamp() returns a valid negative timestamp, but mov_seek_stream bails out with AVERROR_INVALIDDATA. Fixes ticket #6139. Signed-off-by: Jonas Licht --- libavformat/mov.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index a5177e8f91..029d6a152d 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6918,10 +6918,12 @@ static int mov_seek_fragment(AVFormatContext *s, AVStream *st, int64_t timestamp static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, int flags) { MOVStreamContext *sc = st->priv_data; - int sample, time_sample; + int sample, time_sample, ret; unsigned int i; - int ret = mov_seek_fragment(s, st, timestamp); + timestamp -= sc->time_offset; + + ret = mov_seek_fragment(s, st, timestamp); if (ret < 0) return ret;