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 0451F45AFD for ; Thu, 16 Mar 2023 17:10:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4FF6568C053; Thu, 16 Mar 2023 19:10:12 +0200 (EET) Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2E2AA68C036 for ; Thu, 16 Mar 2023 19:10:06 +0200 (EET) Received: by mail-oi1-f177.google.com with SMTP id bp19so1855004oib.4 for ; Thu, 16 Mar 2023 10:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678986604; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=rAFDN0UCed5BELGq3yuesfquUnEdzvf3/6xTLVC8aQc=; b=lGRYV7OOvGuiiZJGAj599XOownYk9NkYnf7qLUNhjsrXhwYG6cGCod9Bjn3Ms7noN6 CIjQcDrCwC4TaZ17BxnlcVEbMNUPAmAbQwq+f/Vr2oS8W3b8z9g2mx+YoH3eqZABDpaL OmSbJjckwIOGE152ITvGgjbe8wYeZxL7qspY/qxbStP+mElmSD+OvUyXFeDEXurSEDHB /MoB4LlUUwGk0m8W1j6xRfhf6KYFUIzBJ/Cc6e6nQ8WnJ98yFXgjnRyhQoOF3bAqAFlc dH5Vg2baGPYLbhpJBnaM8WBLvV6rhsLVQtoGtr2kukMHhRra0Bnve6nGFLpHWqfno/jq 0E/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678986604; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rAFDN0UCed5BELGq3yuesfquUnEdzvf3/6xTLVC8aQc=; b=0E3QHK2V1wX9VW71cN/MB/QTU24Fb+ym5yUEMSN/LliKKtMOQfDgqIuKjucEXFKRFt CPScM1vs77hkZWzYU3V3SVmn6oDV3CdlYYi8VGwH/Biwqxarern7QHNoLtLZALHBMIAw vIJMrhvHXV2pzEPQfdt3AFg0qSqZ39coWFNSMa4gi1mz8f2P9iTjAGFBtkJpMAxbljjN xe8dPIRAOW57w8hj2H/BejCbxEtmPcqCM750+7/ITgzrqGZJgn6mNrx63moH12Y5vu3l NKOhiXbbRHoCwBh9/7lTGwPuBI3myMZjtP7AuH5LqPsxYJ3s4IyonjZ4QuW0RtsEZeT4 4oaQ== X-Gm-Message-State: AO0yUKUNnG45t51Dr92G8GiQkCc1GyLXpP7izeEiI2Ate1Am8+S4OSLJ Q28FDV5RKhxAVWSoQpZRU2vsSWcwtjs= X-Google-Smtp-Source: AK7set/HjuEuWs7Palg5JK+B4PPW8BL7Rwil2xgpnQMzBVoNnE+IQQZR/cmeYWAvvvukYNppD/IA9Q== X-Received: by 2002:a05:6808:2896:b0:384:3e65:d0dd with SMTP id eu22-20020a056808289600b003843e65d0ddmr3296281oib.41.1678986604135; Thu, 16 Mar 2023 10:10:04 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id s9-20020a0568080b0900b003845f4991c7sm1935069oij.11.2023.03.16.10.10.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 10:10:03 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Mar 2023 14:09:49 -0300 Message-Id: <20230316170949.3782-1-jamrial@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/vorbisdec: export skip_samples instead of dropping frames 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: pts may not be set on input packets, which could result in the entire stream being discarded. This undoes commit 8fc2dedfe6e8fcc58dd052bf3b85cd4754133b17, reintroducing the behavior it replaced but now allowing the caller to manually drop the preroll samples by looking at the skip_samples side data at the start while ignoring it on seek, by setting the skip_manual avctx flag. Suggested-by: Anton Khirnov Signed-off-by: James Almer --- libavcodec/vorbisdec.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index dd856a6dfe..e9dad4ef4f 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -38,6 +38,7 @@ #include "codec_internal.h" #include "decode.h" #include "get_bits.h" +#include "internal.h" #include "vorbis.h" #include "vorbisdsp.h" #include "vorbis_data.h" @@ -134,7 +135,6 @@ typedef struct vorbis_context_s { av_tx_fn mdct_fn[2]; uint8_t first_frame; - int64_t initial_pts; uint32_t version; uint8_t audio_channels; uint32_t audio_samplerate; @@ -1839,13 +1839,7 @@ static int vorbis_decode_frame(AVCodecContext *avctx, AVFrame *frame, if (!vc->first_frame) { vc->first_frame = 1; - vc->initial_pts = frame->pts; - } - - if (frame->pts == vc->initial_pts) { - *got_frame_ptr = 0; - av_frame_unref(frame); - return buf_size; + avctx->internal->skip_samples = len; } ff_dlog(NULL, "parsed %d bytes %d bits, returned %d samples (*ch*bits) \n", @@ -1877,6 +1871,7 @@ static av_cold void vorbis_decode_flush(AVCodecContext *avctx) sizeof(*vc->saved)); } vc->previous_window = -1; + vc->first_frame = 0; } const FFCodec ff_vorbis_decoder = { -- 2.39.2 _______________________________________________ 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".