From patchwork Mon Jun 19 21:08:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Licht X-Patchwork-Id: 4049 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.22.4 with SMTP id 4csp1093788vsw; Mon, 19 Jun 2017 14:08:52 -0700 (PDT) X-Received: by 10.28.87.72 with SMTP id l69mr345564wmb.111.1497906532422; Mon, 19 Jun 2017 14:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497906532; cv=none; d=google.com; s=arc-20160816; b=Xn2+i3hgoz5YM20LOOx5d5w6VnViKaimAVHQl8eaztjGVI4KG1mGnRnFCeIi3PGYVh aJpl5Nh83KTcQlcjgXfr3xYDU26+/L385XxzmEUv3ek9p44Bk6mXcn2zaUBA060nDA1U y7kdY1mz2bpwkS9OaTpf7xoFQ8GMDH4xpMZhQX6HnvkU1EqCX43zSxQ2FlG0ZPfl5icV 7U0ZN19cy5Qg/Tl04vhr9ZEoNFCYayomHVej1j51phNyZSsyxkjZIqVygaHhX0I4k91T uscngldbFeyeoewsh+xwfaZYjp96rBXcg8wGvXXx4ig32aaCtwt9C2hphWpSlGY1pObe 0djg== 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=mFvx5Sf1rZ1YKJ1m5YFGpmJ4Qj5MIEd4Z51bV57qhxI=; b=hqIVFmY1n0tNp39Td9jP++3JRtqLTy6WrII1WewG8v5emspTi29CJkDPSpag6gpdAO h4uJpcHObt4sSzwIGEVZQQnSfLG1DCBa9bAnnjf+Ydx4jpQThUZMN7KyC9vCOaQtOYFu cYtU3G6yf3YS6vblJApf2cPfJm5jO3c6Exh++GyndB8cwrZ4bp5QbCMxxAkqXxXkJacl qPx4ws6Ucv23cyX6+vGhK/Wp18pGskzyinN2PHlKZSUaLoWB5Ro3hKI1MJG4hgQfvPoV 7Ps+S/y9xU15FxQRQU+BJQEqM9+9eR09POaA2SCbSTdiD9h1+OhqUs5MTgOB1MXqA3AY qv+Q== 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 p34si706850wrc.158.2017.06.19.14.08.51; Mon, 19 Jun 2017 14:08:52 -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 412B068A60B; Tue, 20 Jun 2017 00:08:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.fem.tu-ilmenau.de (mail.fem.tu-ilmenau.de [141.24.220.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 132B2688396 for ; Tue, 20 Jun 2017 00:08:38 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by mail.fem.tu-ilmenau.de (Postfix) with ESMTP id 339AB682A for ; Mon, 19 Jun 2017 23:08:43 +0200 (CEST) X-Virus-Scanned: amavisd-new at fem.tu-ilmenau.de Received: from mail.fem.tu-ilmenau.de ([127.0.0.1]) by localhost (mail.fem.tu-ilmenau.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ueIJSjVKYC+h; Mon, 19 Jun 2017 23:08:43 +0200 (CEST) Received: from deinemutter.fem.tu-ilmenau.de (deinemutter.fem.tu-ilmenau.de [141.24.40.50]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.fem.tu-ilmenau.de (Postfix) with ESMTPSA; Mon, 19 Jun 2017 23:08:43 +0200 (CEST) From: Jonas Licht To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Jun 2017 23:08:45 +0200 Message-Id: <20170619210845.20641-1-jonas.licht@fem.tu-ilmenau.de> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH] 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" 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 63f84be782..45d5f72aaf 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6615,9 +6615,11 @@ static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, { MOVStreamContext *sc = st->priv_data; int sample, time_sample; - int i; + int i, ret; + + timestamp -= sc->time_offset; - int ret = mov_seek_fragment(s, st, timestamp); + ret = mov_seek_fragment(s, st, timestamp); if (ret < 0) return ret;