From patchwork Sun Apr 9 13:27:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41040 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4645:b0:e3:3194:9d20 with SMTP id eb5csp1572000pzb; Sun, 9 Apr 2023 06:29:29 -0700 (PDT) X-Google-Smtp-Source: AKy350bkZAt2K4odLSJ5RZFFvcVXV4CM4Jryp+vb10oXoZPRibzBvU+I7RAeY/6tYsSoQ3fZiW/Y X-Received: by 2002:aa7:d846:0:b0:4fa:c7c9:62ea with SMTP id f6-20020aa7d846000000b004fac7c962eamr7753684eds.11.1681046969129; Sun, 09 Apr 2023 06:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681046969; cv=none; d=google.com; s=arc-20160816; b=fBZ/KkA5k70YNz8g+XrC31lq9bp0Tn7n/VFhS6zUI0lQD9yUqq+SRYPT1XUhsQRn6D ttRx28SzLsM22en4oJ2RsVHxca8942+ybjrLeqXXvwY0a7Suh5B0VVqT48lKskd4WPQF fLkCNotwmJplYa2Yt0KzBIracHsVLgKrxmZXum+mNXAOORWLsinhwVnhYLw/aO8hHUmf tP4TShb+0yITM3HxuMoq/wHMlHvPCD/7rU2uAEi9Pj64jV34s2Vs6yJIcfCm1GvOn0jZ ZkcUcR6blBvfq5O3Cw1yXNUnUhPWR8H9rOQeGgZlqb/95t1EfZpPutcP5uxOctAcHies 10nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=JTqcwOFYPRhkYzpxz4LWCZnJKVOM4/BPQ7Vu6069CyU=; b=XgKiZngG4viaNU0tzG60M/oWIcq/MfiFudfCUCc3Mk0oO04mDSF6LrwHhde4Sy12F0 JK6T1pgbHjpzz20gLWeW9IudqZT9Zi4C2zr8E/5BglCu+7JVwz2DiSowXrpEMMmqXaFw hc8AbddxSrvxX2LOeczukGI8qXkZ2aP8TIafST6aYyg0bQxOv+YF3BSRH976quJVUqK7 HArJa6GHwIlaVVVoGK2nLfTIBHUWvZKaCsHe5xAPP60PGnYc746Vu6ea4zi1gdKUEpte 34/M8RND1aXfIBVDbXHr3w0WkjzfHC/7lkZqbHY74wqF+ZecX2HcTYL1J8fkFm6nd5xC 9dSQ== 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 ce9-20020a170906b24900b0094a65a01cc6si1513952ejb.1038.2023.04.09.06.29.28; Sun, 09 Apr 2023 06:29:29 -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 187E568BBAF; Sun, 9 Apr 2023 16:28:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2B578689F18 for ; Sun, 9 Apr 2023 16:28:45 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E352C2404F8 for ; Sun, 9 Apr 2023 15:28:44 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id WKDf7n9ZEKdS for ; Sun, 9 Apr 2023 15:28:44 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 79E3D240591 for ; Sun, 9 Apr 2023 15:28:43 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 2CFB53A042D for ; Sun, 9 Apr 2023 15:28:37 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 9 Apr 2023 15:27:44 +0200 Message-Id: <20230409132746.19756-5-anton@khirnov.net> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230409132746.19756-1-anton@khirnov.net> References: <20230409132746.19756-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/7] fftools/ffmpeg: use InputStream.pts as last resort for decoded frame pts X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: JMGhEIWxrSZz --- fftools/ffmpeg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 17eb9ea5964..d38054be2f1 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2300,6 +2300,9 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_ ist->nb_dts_buffer--; } + if (best_effort_timestamp == AV_NOPTS_VALUE) + best_effort_timestamp = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ist->st->time_base); + if(best_effort_timestamp != AV_NOPTS_VALUE) { int64_t ts = av_rescale_q(decoded_frame->pts = best_effort_timestamp, ist->st->time_base, AV_TIME_BASE_Q);