From patchwork Thu Feb 20 20:28:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anssi Hannula X-Patchwork-Id: 17858 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 3837744A78B for ; Thu, 20 Feb 2020 22:31:09 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 13A3F68B093; Thu, 20 Feb 2020 22:31:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from sinikuusama2.dnainternet.net (sinikuusama2.dnainternet.net [83.102.40.152]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2493F68B093 for ; Thu, 20 Feb 2020 22:31:01 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by sinikuusama2.dnainternet.net (Postfix) with ESMTP id 8B1F911A89 for ; Thu, 20 Feb 2020 22:30:59 +0200 (EET) X-Virus-Scanned: DNA Internet at dnainternet.net X-Spam-Flag: NO X-Spam-Score: 0.25 X-Spam-Level: X-Spam-Status: No, score=0.25 tagged_above=-9999 required=6 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.248, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=disabled Received: from sinikuusama2.dnainternet.net ([83.102.40.152]) by localhost (sinikuusama2.dnainternet.net [127.0.0.1]) (DNA Internet, port 10041) with ESMTP id 8iEekc73ATb9 for ; Thu, 20 Feb 2020 22:30:59 +0200 (EET) Received: from omenapuu2.dnainternet.net (omenapuu2.dnainternet.net [83.102.40.54]) by sinikuusama2.dnainternet.net (Postfix) with ESMTP id 3329911A4B for ; Thu, 20 Feb 2020 22:30:59 +0200 (EET) Received: from mail.onse.fi (unknown [109.204.156.230]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by omenapuu2.dnainternet.net (Postfix) with ESMTPS id 1188F2B6 for ; Thu, 20 Feb 2020 22:30:57 +0200 (EET) Received: by mail.onse.fi (Postfix, from userid 1000) id 8FD56402CB; Thu, 20 Feb 2020 22:30:57 +0200 (EET) From: Anssi Hannula To: ffmpeg-devel@ffmpeg.org Date: Thu, 20 Feb 2020 22:28:16 +0200 Message-Id: <20200220202816.3132656-1-anssi.hannula@iki.fi> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/mux: allow non-monotonic ts with AVFMT_NOTIMESTAMPS 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Allow non-monotonic input timestamps for muxers with no timestamps at all (AVFMT_NOTIMESTAMPS). This is frequently hit when muxing TrueHD with spdifenc as many MKV files use 1ms timestamps while TrueHD frames are shorter than that (1/1200 sec for 48kHz-based and 1/1102.5 sec for 44.1kHz-based rates). --- libavformat/mux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mux.c b/libavformat/mux.c index 3533932a58..ba6695badb 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -622,7 +622,7 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket * } if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && - ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) && + ((!(s->oformat->flags & (AVFMT_NOTIMESTAMPS | AVFMT_TS_NONSTRICT)) && st->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE && st->codecpar->codec_type != AVMEDIA_TYPE_DATA && st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) {