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 F143340212 for ; Thu, 21 Apr 2022 03:23:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9A77F68B2A4; Thu, 21 Apr 2022 06:23:02 +0300 (EEST) Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3E64868B193 for ; Thu, 21 Apr 2022 06:22:56 +0300 (EEST) Received: by mail-pg1-f182.google.com with SMTP id r83so3545181pgr.2 for ; Wed, 20 Apr 2022 20:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=86dpdfzZSTC1PoCeyC8r+pGNZd0U+W+MhlHbksR1OJc=; b=UC4nWm6bLfw6EpacF9fVAYBDHAChlD/f6pKu6vVx58i8OsTmBjyNQDIunq5QfOtsrY 6rZXK2iBM5nuugzlHJJ1zPcvItZ+qyqZSM0ZtZz73E4j3edFqG7ZHkMwwisG9pj5RhQc S0pcqeM/wfDZLdP83xpDROXV1buy0HqcB+BawU+OCqLOQmg8jqIo4vrUfnhSFrMbklij Mo1RWvFQWbr89CGsRTbrjdUVD+73Nfd95pWqTaqo+I/EEBsNLP3R2fpaGHz9JzozHWRT 9CmsxRv1XuAW8ZyHS84TzcSBQfQEvalNPL0FKPyCgwItxziKq+O/fqImmn5wQwGYpIRV OF3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=86dpdfzZSTC1PoCeyC8r+pGNZd0U+W+MhlHbksR1OJc=; b=UJHOpIPaFxzlqQMfjS8A3ZO5wHUVjyuWZadaFx7qb9A8uGp/t7vsOVHJ2VS6/ISec0 w+jVInOPEiOQscd/zIm0KJu/6Pi/lWDOvQZjJkXstv7pOeXloGq0zqycbvQ7VGk0bVbt GcZk/I0KAONkhxVb41Gqxie6ps++SaikvWMoVCnP3/b9ZEdUOjCubQcU8Ush4Y+zqqvo u7CU2SC+oT0jUApRuhpAmJHW6fRcdBGyj6PQU0BIJXH3QFwCqrMiYn6kOzkX9mYNE/8A CbbH8mNS+Y/dVw5UkQOBBBMmE3zBBwnWPtVAIq698d8nsrR64W5ZyCgwFqtHpYL5oLRv +Lzw== X-Gm-Message-State: AOAM532g02Nx13jTnGU/u6YByYKFFnSDjMmLaKzm/7K0xndhw1oSsLFM nU/0o0F0d/zow1Tbcm1CJSzHOTutpm0= X-Google-Smtp-Source: ABdhPJwpXqjQgDzGX2jle45d/9NHkTfr7l0p8uHqKWG8dvDma0JCcy+uYwwyYZgvdFRoBAX18dgXHQ== X-Received: by 2002:a65:5181:0:b0:3aa:3668:26a9 with SMTP id h1-20020a655181000000b003aa366826a9mr10617869pgq.184.1650511373785; Wed, 20 Apr 2022 20:22:53 -0700 (PDT) Received: from localhost.localdomain (99-106-168-104.lightspeed.sntcca.sbcglobal.net. [99.106.168.104]) by smtp.gmail.com with ESMTPSA id y9-20020aa79429000000b0050ad02027d9sm2400190pfo.197.2022.04.20.20.22.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Apr 2022 20:22:53 -0700 (PDT) From: Guangyu Sun X-Google-Original-From: Guangyu Sun To: ffmpeg-devel@ffmpeg.org Date: Wed, 20 Apr 2022 20:22:51 -0700 Message-Id: <20220421032251.9866-1-gsun@roblox.com> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/oggparsevorbis: Ignore duration of the first packet 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: 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. This commit fixes #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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index 289900f7cf..1f922b3c7e 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -479,6 +479,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 ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && os->segp == 1) + os->pduration = 0; } /* final packet handling -- 2.30.1 _______________________________________________ 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".