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 2D89745610 for ; Wed, 8 Feb 2023 06:33:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C824D68BE46; Wed, 8 Feb 2023 08:33:45 +0200 (EET) Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5C2D868BE7B for ; Wed, 8 Feb 2023 08:33:39 +0200 (EET) Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4PBVZ84wcrz9sW2 for ; Wed, 8 Feb 2023 07:33:36 +0100 (CET) Message-ID: <00d390d4-4885-5854-dad3-a8bf9e250ad0@gyani.pro> Date: Wed, 8 Feb 2023 12:03:22 +0530 MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org References: <20230204100657.6882-1-ffmpeg@gyani.pro> Content-Language: en-US From: Gyan Doshi In-Reply-To: <20230204100657.6882-1-ffmpeg@gyani.pro> Subject: Re: [FFmpeg-devel] [PATCH v2] avcodec/h264_metadata_bsf: remove AUDs at any position 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2023-02-04 03:36 pm, Gyan Doshi wrote: > Some files, likely due to faulty packetization or muxing, can have AUDs > at other positions besides the head unit of a packet. Remove these too. Plan to push in 24h if no more comments. > --- > libavcodec/h264_metadata_bsf.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c > index d318bf0cee..b9cfeaba94 100644 > --- a/libavcodec/h264_metadata_bsf.c > +++ b/libavcodec/h264_metadata_bsf.c > @@ -469,12 +469,13 @@ static int h264_metadata_update_fragment(AVBSFContext *bsf, AVPacket *pkt, > H264MetadataContext *ctx = bsf->priv_data; > int err, i, has_sps, seek_point; > > - // If an AUD is present, it must be the first NAL unit. > - if (au->nb_units && au->units[0].type == H264_NAL_AUD) { > - if (ctx->aud == BSF_ELEMENT_REMOVE) > - ff_cbs_delete_unit(au, 0); > - } else { > - if (pkt && ctx->aud == BSF_ELEMENT_INSERT) { > + if (ctx->aud == BSF_ELEMENT_REMOVE) { > + for (i = au->nb_units - 1; i >= 0; i--) { > + if (au->units[i].type == H264_NAL_AUD) > + ff_cbs_delete_unit(au, i); > + } > + } else if (ctx->aud == BSF_ELEMENT_INSERT) { > + if (pkt) { > err = h264_metadata_insert_aud(bsf, au); > if (err < 0) > return err; _______________________________________________ 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".