From patchwork Wed Sep 14 08:13:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinzheng Zhang X-Patchwork-Id: 569 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp2542563vsd; Wed, 14 Sep 2016 01:14:09 -0700 (PDT) X-Received: by 10.194.23.165 with SMTP id n5mr609125wjf.137.1473840849660; Wed, 14 Sep 2016 01:14:09 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e4si3041146wjh.33.2016.09.14.01.14.07; Wed, 14 Sep 2016 01:14:09 -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; 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 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 E217C68A073; Wed, 14 Sep 2016 11:13:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D6D6F68A055 for ; Wed, 14 Sep 2016 11:13:45 +0300 (EEST) Received: by mail-pf0-f196.google.com with SMTP id n24so425544pfb.3 for ; Wed, 14 Sep 2016 01:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=pyiqUzYal1yx9VVsiA8l9equyrOHYF51EtBItQ5iUUs=; b=NkVk+ECdeK+CSSeb9vD2ma48ahwp0sblnSrtXKZoRjonY2Vuiohj0mHXMinJDa13f3 vbSpRs7Jj2kZCLyrzOSJiKfpGV7TEIejfbBnfCxgtnLq/yCVoE/9ZdVIW4QGDbBE18ta yZo5hUSCoq54SbodUMw6L4s5tQrofsiZZXBnilWCOsQ78dNs6hr00teGcjOgjT71ooVj bBy8wSSvALGo5b+ngThIzjhE0JM3Uzdx8IjlJznvllCxRYCPxl1IhefJy75SBSpJJarj zGK7+LDWm5TTvt62aihUIXYuIGcFBhJQvOd+SFi7XqNCzwhFxb7K1x09QtXwdAhOLa9Y 9M3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pyiqUzYal1yx9VVsiA8l9equyrOHYF51EtBItQ5iUUs=; b=iiiZlAxFwWG5l5/jYT6WCBFyWXiNbLe6HPYTWLv90ZikSys8nGEEgCCgwYMRFt6vNy nB+TcCrcvHbZtLkkOA+zOje1wKTY2+JM1/oesqVX3YGLR1Uh1m0ikDUD+QQU+FReI3jf sF7iTtYGh5hfe/s8UjpFd+ukpZKYHsCTeC7duu2jbZ5xyFnvKWMW1TrSn5RedhJnNgy3 48om47LfEhUn8rGQLXrUW3bF/62UaFb5QCXZp3nZbsnoCqefJFGmaUUI3dPWtIVHYHw+ q5kcg/ejzZcvKoeZaRVNbPG+P3urvUDoBAJWvrerUr1MG9uhk6QGl0RKY+svuLW/Vc+E Su/w== X-Gm-Message-State: AE9vXwPrpRT+djylCApjKUHKJRm/ll2iyTH6l2ZqUxEtFvpwrKDoGcG7a11Hlz0mLrr0UA== X-Received: by 10.98.110.4 with SMTP id j4mr2302632pfc.56.1473840836905; Wed, 14 Sep 2016 01:13:56 -0700 (PDT) Received: from localhost.localdomain (014136134118.ctinets.com. [14.136.134.118]) by smtp.gmail.com with ESMTPSA id p17sm36059865pfi.7.2016.09.14.01.13.55 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 14 Sep 2016 01:13:56 -0700 (PDT) From: Xinzheng Zhang To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Sep 2016 16:13:45 +0800 Message-Id: <1473840825-61478-1-git-send-email-zhangxzheng@gmail.com> X-Mailer: git-send-email 2.6.4 (Apple Git-63) Subject: [FFmpeg-devel] [PATCH] avformat/utils: fix timebase error in avformat_seek_file() 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: Xinzheng Zhang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" When there is only one stream and stream_index has not specified, The ts has been transferd by the timebase of stream0 without modifying the stream_index In this condation it cause seek failure. --- libavformat/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index daf2d5b..6aedb5d 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2412,6 +2412,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, max_ts = av_rescale_rnd(max_ts, time_base.den, time_base.num * (int64_t)AV_TIME_BASE, AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); + stream_index = 0; } ret = s->iformat->read_seek2(s, stream_index, min_ts,