From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 01AD8475E5 for ; Wed, 13 Dec 2023 19:31:20 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0BDEB68D130; Wed, 13 Dec 2023 21:30:35 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9B12968CDD1 for ; Wed, 13 Dec 2023 21:30:28 +0200 (EET) Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 4F9141CAE for ; Wed, 13 Dec 2023 20:30:24 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id tqeh76wZODRS for ; Wed, 13 Dec 2023 20:30:24 +0100 (CET) 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 mail1.khirnov.net (Postfix) with ESMTPS id 7BD771CAF for ; Wed, 13 Dec 2023 20:30:21 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 921B23A07D5 for ; Wed, 13 Dec 2023 20:30:14 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 13 Dec 2023 20:30:07 +0100 Message-ID: <20231213193007.17471-12-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231213193007.17471-1-anton@khirnov.net> References: <20231213193007.17471-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/12] fftools/ffmpeg_sched: track dts+duration as last_dts 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This should be slightly (probably negligibly) more accurate for scheduling, but mainly it improves the final reported time. Reported-by: Paul B Mahol --- fftools/ffmpeg_sched.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c index b1c7db776e..263b0094ca 100644 --- a/fftools/ffmpeg_sched.c +++ b/fftools/ffmpeg_sched.c @@ -192,7 +192,7 @@ typedef struct SchMuxStream { //////////////////////////////////////////////////////////// // The following are protected by Scheduler.schedule_lock // - /* dts of the last packet sent to this stream + /* dts+duration of the last packet sent to this stream in AV_TIME_BASE_Q */ int64_t last_dts; // this stream no longer accepts input @@ -1619,8 +1619,8 @@ static int send_to_mux(Scheduler *sch, SchMux *mux, unsigned stream_idx, AVPacket *pkt) { SchMuxStream *ms = &mux->streams[stream_idx]; - int64_t dts = (pkt && pkt->dts != AV_NOPTS_VALUE) ? - av_rescale_q(pkt->dts, pkt->time_base, AV_TIME_BASE_Q) : + int64_t dts = (pkt && pkt->dts != AV_NOPTS_VALUE) ? + av_rescale_q(pkt->dts + pkt->duration, pkt->time_base, AV_TIME_BASE_Q) : AV_NOPTS_VALUE; // queue the packet if the muxer cannot be started yet -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".