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 D494843574 for ; Thu, 16 Jun 2022 23:23:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 117CB68B7E9; Fri, 17 Jun 2022 02:23:11 +0300 (EEST) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1DCB68B7B2 for ; Fri, 17 Jun 2022 02:23:04 +0300 (EEST) Received: by mail-pj1-f54.google.com with SMTP id b12-20020a17090a6acc00b001ec2b181c98so1508860pjm.4 for ; Thu, 16 Jun 2022 16:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=roblox.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=oaN9WuB56aNPKAec9oKRZcsMTCXarvagNtY9tteXjlc=; b=LmxED4FG+QlcFFzSyF4rSjSf2C6MDFWD1pBWjktJ0+g1ZGg3nmlGgdponuCXh/e8M3 QalJKpDpo9v3fXp2q5nbvXJnqerIgzBjeJT4iInvt/3AbprGR44aWAOveeS8ZKjHtrl8 VUJ66W0SEH0viXtGTjwKB0znyDZX+e9wPDwdI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=oaN9WuB56aNPKAec9oKRZcsMTCXarvagNtY9tteXjlc=; b=0c7ZIKt8mmIBPj0Mf+G9A6ROrRO7jMkpNBZk2DloR6G2YJqCJVOUVV+SyQV4YjMtBD ThIULOXfE0NtLUdXNjAshm9j5PiaKEjK1dKw23c5LfPZiw/omPg5E7bkCr/AmUzMuUmZ FJKfECDNtMt3gHVfwdopWekF2VujDB7C4XE5vBxinyaYc1juMrv9c+nOyeq042aeKIME cHqvfeQxH5WA+SinppXjdEFRZNthaZMrOKKfIZHD9CQwof4x4/0BxH79j7IxhO/Wi6jS nYT07gpwUjcRbBA810erPfP+rT8S9Ew7Tw1Xri/T0YRuo7LmZOwNFhXmvD0n3bYXZrtj mHiw== X-Gm-Message-State: AJIora+sAxczaPWfKYyBpbkGdoYr/H4uMpyvr5Ww16qDvRFfTlvsUBNc +K1kv5cVvMFViFDVyTlJ8OLlMIVQttScdEijRjUTTDRNQrQ= X-Google-Smtp-Source: AGRyM1tkTmPU5VNtrR9NUYoCW0J6gPDWX1BBPH6d5zpnR5fD/lypjQdCwt0y1O1G92Xr/O340m42od/q60+ET2pCByA= X-Received: by 2002:a17:902:f1cb:b0:16a:410:2fc0 with SMTP id e11-20020a170902f1cb00b0016a04102fc0mr842060plc.21.1655421782434; Thu, 16 Jun 2022 16:23:02 -0700 (PDT) MIME-Version: 1.0 References: <20220505230458.1024-1-gsun@roblox.com> In-Reply-To: From: Guangyu Sun Date: Thu, 16 Jun 2022 16:22:51 -0700 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH] avformat/oggparsevorbis: Fix oggvorbis duration parsing for small files 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: On Mon, May 16, 2022 at 5:05 PM Guangyu Sun wrote: > > On Mon, May 9, 2022 at 11:19 AM Guangyu Sun wrote: > > > On Thu, May 5, 2022 at 4:05 PM Guangyu Sun wrote: > > > >> The decoded Data is not returned from the first frame; it must be used > >> to 'prime' the decode engine. The duration of the first packet should > >> be ignored also by the container, to make sure the total duration is > >> trimmed correctly. > >> > >> If the file has multiple pages for the data packets. The duration of the > >> last packet can be correctly adjusted without being affected by the first > >> packet. But if the first packet and the last packet are located in the > >> same page, the duration of the last packet will have an unwanted offset. > >> > >> This commit fixes https://trac.ffmpeg.org/ticket/6367. > >> > >> dd if=/dev/zero of=./silence.raw count=1 bs=500 > >> oggenc --raw silence.raw --output=silence.ogg > >> oggdec --raw --output silence.oggdec.raw silence.ogg > >> ffmpeg -codec:a libvorbis -i silence.ogg -f s16le -codec:a pcm_s16le > >> silence.libvorbis.ffmpeg.raw > >> ffmpeg -i silence.ogg -f s16le -codec:a pcm_s16le > >> silence.native.ffmpeg.raw > >> ls -l *.raw > >> > >> Signed-off-by: Guangyu Sun > >> --- > >> libavformat/oggparsevorbis.c | 11 ++++++++++- > >> 1 file changed, 10 insertions(+), 1 deletion(-) > >> > >> diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c > >> index 289900f7cf..9a486c9fe8 100644 > >> --- a/libavformat/oggparsevorbis.c > >> +++ b/libavformat/oggparsevorbis.c > >> @@ -412,6 +412,7 @@ static int vorbis_packet(AVFormatContext *s, int idx) > >> struct ogg_stream *os = ogg->streams + idx; > >> struct oggvorbis_private *priv = os->private; > >> int duration, flags = 0; > >> + int first_page; > >> > >> if (!priv->vp) > >> return AVERROR_INVALIDDATA; > >> @@ -420,7 +421,8 @@ static int vorbis_packet(AVFormatContext *s, int idx) > >> * here we parse the duration of each packet in the first page and > >> compare > >> * the total duration to the page granule to find the encoder delay > >> and > >> * set the first timestamp */ > >> - if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & > >> OGG_FLAG_EOS) && (int64_t)os->granule>=0) { > >> + first_page = !os->lastpts || os->lastpts == AV_NOPTS_VALUE; > >> + if (first_page && !(os->flags & OGG_FLAG_EOS) && > >> (int64_t)os->granule>=0) { > >> int seg, d; > >> uint8_t *last_pkt = os->buf + os->pstart; > >> uint8_t *next_pkt = last_pkt; > >> @@ -479,6 +481,13 @@ static int vorbis_packet(AVFormatContext *s, int idx) > >> flags = 0; > >> } > >> os->pduration = duration; > >> + /* Data is not returned from the first frame; it must be used to > >> 'prime' > >> + * the decode engine. The duration of the first packet should be > >> ignored > >> + * also by the container, to make sure the total duration is > >> trimmed > >> + * correctly. > >> + */ > >> + if (first_page && os->segp == 1) > >> + os->pduration = 0; > >> } > >> > >> /* final packet handling > >> -- > >> 2.30.1 > >> > >> > > Ping. > > > Ping again. This patch fixes an oggvorbis transcode issue. > https://devforum.roblox.com/t/recent-changes-to-uploaded-audio-compressionprocessing-causing-timing-drift/1735440/10 > _______________________________________________ > 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". Ping. Any feedback about this patch? _______________________________________________ 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".