From patchwork Sun Sep 29 09:27:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 15378 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 E6C1944A8CD for ; Sun, 29 Sep 2019 12:33:36 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BF9986898C0; Sun, 29 Sep 2019 12:33:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6016D68925F for ; Sun, 29 Sep 2019 12:33:30 +0300 (EEST) Received: by mail-pf1-f195.google.com with SMTP id q21so3819434pfn.11 for ; Sun, 29 Sep 2019 02:33:30 -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; bh=++2EfcUi/59kpj+R7+ZD0UcgJCLgYEaLtnwWhx2LZsU=; b=DzlmshWTRIMjx4LXToom46L00vuWzgUX4d9Xsj48gVhqzrZioZLMcbJlvf81jrL0SL RD8CSiVrUrmdfhOnxCGUCEaUOSb6NMY4tmP3i5WNI1jNRhLMK5TmAlfXXV0X0WhcbZVc qQUUIUn0u84He2IQMC7afNG3reA6S+Cu39PC5mOzKE4MW55H6PUCTxporNbKUiJUXpYf KtOc85B0VnTPABDjLNs/8/XApAabLFxQ/NWnNzTNlt4St/VDpwiQMmrrYZ/9xzRmsUy2 OjmYIbevbM4YtVaCa2bxSWKb1QwBBo5JNic7GhVfKlHLFpbZ62mAnzAOm8j5ukrWY/4u Tazg== 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; bh=++2EfcUi/59kpj+R7+ZD0UcgJCLgYEaLtnwWhx2LZsU=; b=ctf7UYMIcQ2QAbrZSqmYwWV1h5EaT12aBZh7lS5TyuxOpA14VlL9f7vDtx9O2BBVgc hT1NNFqzBsjOK/HGBVfZ47WxBFAkziGQV1wcHHNvLCCLrgtahTshnMQFIWI1tQb1zgKu V0Gq+o1xODj417EIN2Fpqd7Qr6fXGLd32cYOylMrgtSzHloePTmemgiFB9TPy+XL+SSj 3erM/Cx/Qmnl4c4HTr7WS8dHCigvf2SLA5WmhRwBRPx11oR5Y3gJt8m1RLtI697/sYAy kCzHdA0nlya8TuyifGBkM+JMETWw5VeZYepRROeETiSJ2tIhKdhO18e62phR3NclBzpa I7jg== X-Gm-Message-State: APjAAAU/8XEr3gFN3Wzwu4ANT8BbCzZkjV29Db3SZ/VYyl/xODh6FCK3 UgD7g8SK5NXyhc6d8n73Yvij+pUD X-Google-Smtp-Source: APXvYqycf0uwTPGzpTMXdOo3Y2z/0C5KtuSqkbzewamYHpCUv+5R5I82saWkD/aO3cYWiqajv06llQ== X-Received: by 2002:a17:90a:c255:: with SMTP id d21mr20483839pjx.129.1569749286921; Sun, 29 Sep 2019 02:28:06 -0700 (PDT) Received: from localhost.localdomain ([47.90.47.25]) by smtp.gmail.com with ESMTPSA id i132sm2585106pgd.47.2019.09.29.02.28.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Sep 2019 02:28:06 -0700 (PDT) From: Jun Zhao To: ffmpeg-devel@ffmpeg.org Date: Sun, 29 Sep 2019 17:27:52 +0800 Message-Id: <1569749274-13151-4-git-send-email-mypopydev@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1569749274-13151-1-git-send-email-mypopydev@gmail.com> References: <1569749274-13151-1-git-send-email-mypopydev@gmail.com> Subject: [FFmpeg-devel] [PATCH V2 3/5] lavf/utils: correct the duration estimation method for nut demuxer 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: Jun Zhao MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Jun Zhao in fact, nut demuxer use the PTS for duration estimation. Signed-off-by: Jun Zhao --- libavformat/utils.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 07f02a7..9d69e3a 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2956,7 +2956,11 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) /* at least one component has timings - we use them for all * the components */ fill_all_stream_timings(ic); - ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; + /* nut demuxer estimate the duration from PTS */ + if(!strcmp(ic->iformat->name, "nut")) + ic->duration_estimation_method = AVFMT_DURATION_FROM_PTS; + else + ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; } else { /* less precise: use bitrate info */ estimate_timings_from_bit_rate(ic);