From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 233E94D81E for <ffmpegdev@gitmailbox.com>; Sun, 20 Apr 2025 20:08:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C1DA8687D5D; Sun, 20 Apr 2025 23:08:31 +0300 (EEST) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 80476687C59 for <ffmpeg-devel@ffmpeg.org>; Sun, 20 Apr 2025 23:08:25 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id B4715443A6 for <ffmpeg-devel@ffmpeg.org>; Sun, 20 Apr 2025 20:08:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1745179704; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SaZm9sSdV1kZRVAhbeIkpsPE2LZYPb5FUt8EXZvEzJk=; b=du/JX7vOM3pgRU0PLlnN7d/j9A42535fp1ypMaPfEyp3esw0D1jsJzv8NJp3hvuToVeUHo 7Vkb41mCVLmirP0XLnikUTDujZprBMtz+qj9CCDqGxU2y3Mv/hYaeJOFz+mEyqf5Km5HAU S1dEFVNiYgRkHz996wyq4QghJ0Nz+sbWvNQg6Fjbof1Y1QWhloUAZ0LXLpl2RQS1Y85PzZ doAnF4RANNlcVF7scE/fNN9Q6xTZD8Cj6NxN0h4hV7/wfqXImoECXXURafuWhKLsGl+juf G30GQcc/2gwsKxHpoHpSTe0OTspxN7q+pFd+LprxHXwpp5/7h9vPOrpRUJ+R3g== Date: Sun, 20 Apr 2025 22:08:22 +0200 From: Michael Niedermayer <michael@niedermayer.cc> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Message-ID: <20250420200822.GF4991@pb2> References: <20250415222236.78392-1-romain.beauxis@gmail.com> <20250415222236.78392-2-romain.beauxis@gmail.com> MIME-Version: 1.0 In-Reply-To: <20250415222236.78392-2-romain.beauxis@gmail.com> X-GND-State: clean X-GND-Score: -70 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeekkeehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdeftddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeeigeektdejudffjefhteegjedtgeettefggedthfejgfevhfetgeekjedtvdfhveenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH v12 1/8] libavcodec/decode.c: intercept `AV_PKT_DATA_METADATA_UPDATE` packet extra data, attach them to the next decoded frame. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Content-Type: multipart/mixed; boundary="===============2804376365051124119==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250420200822.GF4991@pb2/> List-Archive: <https://master.gitmailbox.com/ffmpegdev/> List-Post: <mailto:ffmpegdev@gitmailbox.com> --===============2804376365051124119== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="wWpzE/UVsKA7pAX1" Content-Disposition: inline --wWpzE/UVsKA7pAX1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 15, 2025 at 05:22:29PM -0500, Romain Beauxis wrote: > --- > libavcodec/decode.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) >=20 > diff --git a/libavcodec/decode.c b/libavcodec/decode.c > index fca0c7ff58..06d899a9dd 100644 > --- a/libavcodec/decode.c > +++ b/libavcodec/decode.c > @@ -97,6 +97,8 @@ typedef struct DecodeContext { > int lcevc_frame; > int width; > int height; > + > + AVDictionary *pending_metadata; > } DecodeContext; > =20 > static DecodeContext *decode_ctx(AVCodecInternal *avci) > @@ -702,6 +704,8 @@ int attribute_align_arg avcodec_send_packet(AVCodecCo= ntext *avctx, const AVPacke > { > AVCodecInternal *avci =3D avctx->internal; > DecodeContext *dc =3D decode_ctx(avci); > + const uint8_t *side_metadata; > + size_t size; > int ret; > =20 > if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec)) > @@ -719,6 +723,14 @@ int attribute_align_arg avcodec_send_packet(AVCodecC= ontext *avctx, const AVPacke > ret =3D av_packet_ref(avci->buffer_pkt, avpkt); > if (ret < 0) > return ret; > + > + side_metadata =3D av_packet_get_side_data(avpkt, AV_PKT_DATA_MET= ADATA_UPDATE, &size); > + if (side_metadata) { > + av_dict_free(&dc->pending_metadata); > + ret =3D av_packet_unpack_dictionary(side_metadata, size, &dc= ->pending_metadata); > + if (ret < 0) > + return ret; > + } > } else > dc->draining_started =3D 1; > =20 > @@ -788,6 +800,7 @@ fail: > int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) > { > AVCodecInternal *avci =3D avctx->internal; > + DecodeContext *dc =3D decode_ctx(avci); > int ret; > =20 > if (avci->buffer_frame->buf[0]) { > @@ -810,6 +823,11 @@ int ff_decode_receive_frame(AVCodecContext *avctx, A= VFrame *frame) > =20 > avctx->frame_num++; > =20 > + if (dc->pending_metadata) { > + av_dict_copy(&frame->metadata, dc->pending_metadata, AV_DICT_APP= END); > + av_dict_free(&dc->pending_metadata); > + } > + > return 0; > fail: > av_frame_unref(frame); > @@ -2220,4 +2238,5 @@ void ff_decode_internal_uninit(AVCodecContext *avct= x) > DecodeContext *dc =3D decode_ctx(avci); > =20 > av_refstruct_unref(&dc->lcevc); > + av_dict_free(&dc->pending_metadata); > } > --=20 > 2.39.5 (Apple Git-154) My issue with this is the same as it was previously Please correct me if iam wrong (it is very possible that iam wrong on some assumtations here) the decoder is variable delay (exact delay depends on cpu cores and luck) on the input we have some side data from an AVPacket then some packets will result in nothing to come out (because maybe they ar= e damaged or the users asked non key frames to be skiped or whatever) some packets will decode into AVFrames in one of several threads and these AVFrames then come back out how can code that seems to ignore this be correct ? Shouldnt the data be associated with the packet go through the decoder with it ? Or is this data not associated with the packet in that sense ? thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle=20 --wWpzE/UVsKA7pAX1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaAVUMgAKCRBhHseHBAsP q7yFAJ4/AMkC+lztIfbLEC8hkBlCe/WSYwCbBsYcGdUFKU7/y4hEdDHdnL3RN6Q= =/W9F -----END PGP SIGNATURE----- --wWpzE/UVsKA7pAX1-- --===============2804376365051124119== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============2804376365051124119==--