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 E160E4C840 for <ffmpegdev@gitmailbox.com>; Wed, 9 Apr 2025 14:55:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 66AF068BA34; Wed, 9 Apr 2025 17:55:26 +0300 (EEST) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BAC7C687ABC for <ffmpeg-devel@ffmpeg.org>; Wed, 9 Apr 2025 17:55:19 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 1D274441A8 for <ffmpeg-devel@ffmpeg.org>; Wed, 9 Apr 2025 14:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1744210519; 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=iZmx26WSQgezp1AKUdZewQ4/5zXkqAiQzGIxYm9Snvw=; b=Vjh/TcvOL0CnI2c1muV0Id7tjslDyQMZCwjyUIU9vqrRclmkp7WCF1fHdk35aiAeLqtxPo RzaK/ehnhMQvkL592LtDnjMAWBTymIL2+4I4E9UqGrPn6Tj4nTzHQTzm+9h7+GOlh4kHDY nU+jPNk8Enq6we3d8e9a0kg08629gFjAU3ojOr/fyGLOrJB0p0SaK14UZmyiTnOvT6ZDN8 iBMSoylTOQ3IjGg2kUJbOWa4k/x4Regr1sKtMRvn/hiBpnMRWRhwOTgVyzis521TIHXalV KRcryU6GYi/TQy+yv90aH+mefASfID2/F714mOvvDbokZTM9vHjNIWjx3U08jg== Date: Wed, 9 Apr 2025 16:55:18 +0200 From: Michael Niedermayer <michael@niedermayer.cc> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Message-ID: <20250409145518.GX4991@pb2> References: <20250405-video-only-kf-recover-v2-1-000e71a29ccb@riseup.net> MIME-Version: 1.0 In-Reply-To: <20250405-video-only-kf-recover-v2-1-000e71a29ccb@riseup.net> X-GND-State: clean X-GND-Score: -90 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvtdeivdelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculddutddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeffledtfeevfeffheeuuefhtdejieelueeftdeitdfgheetgefffeefteekffdthfenucffohhmrghinhepfhhfmhhpvghgrdhorhhgnecukfhppeeguddrieeirdeijedruddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeguddrieeirdeijedruddufedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH v2] avformat/fifo: Check for keyframe video type before stop dropping 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="===============5680302820521932530==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250409145518.GX4991@pb2/> List-Archive: <https://master.gitmailbox.com/ffmpegdev/> List-Post: <mailto:ffmpegdev@gitmailbox.com> --===============5680302820521932530== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="cS+Y9K/79EVUS3Mf" Content-Disposition: inline --cS+Y9K/79EVUS3Mf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 05, 2025 at 02:49:30PM -0300, Arthur Grillo wrote: > The current behavior when using restart_with_keyframe is that it will > recover if it also encounters any audio packet, as they are flagged as a > keyframe. >=20 > The expectation is that packets are dropped until the next _video_ > keyframe. >=20 > To fix that, check if exists a video stream, if it exists check the > packet stream codec type, only letting it recover when it is a video > one. If there is no video stream, resume to the original behavior, not > checking the codec type. >=20 > Fixes ticket: #11467 >=20 > Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net> > --- > Changes in v2: > - Check for the presence of a video stream (Michael Niedermayer) > - Link to v1: https://patchwork.ffmpeg.org/project/ffmpeg/patch/20250312-= video-only-kf-recover-v1-1-1e0e340da663@riseup.net [...] > } FifoThreadContext; > =20 > typedef enum FifoMessageType { > @@ -185,14 +188,26 @@ static int fifo_thread_write_packet(FifoThreadConte= xt *ctx, AVPacket *pkt) > AVRational src_tb, dst_tb; > int ret, s_idx; > int64_t orig_pts, orig_dts, orig_duration; > + enum AVMediaType stream_codec_type =3D avf->streams[pkt->stream_inde= x]->codecpar->codec_type; > =20 > if (fifo->timeshift && pkt->dts !=3D AV_NOPTS_VALUE) > atomic_fetch_sub_explicit(&fifo->queue_duration, next_duration(a= vf, pkt, &ctx->last_received_dts), memory_order_relaxed); > =20 > if (ctx->drop_until_keyframe) { > if (pkt->flags & AV_PKT_FLAG_KEY) { > - ctx->drop_until_keyframe =3D 0; > - av_log(avf, AV_LOG_VERBOSE, "Keyframe received, recovering..= =2E\n"); > + if (!ctx->has_video_stream) { > + ctx->drop_until_keyframe =3D 0; > + av_log(avf, AV_LOG_VERBOSE, "Keyframe received, recoveri= ng...\n"); > + } else { > + if (stream_codec_type =3D=3D AVMEDIA_TYPE_VIDEO) { > + ctx->drop_until_keyframe =3D 0; > + av_log(avf, AV_LOG_VERBOSE, "Video keyframe received, re= covering...\n"); > + } else { The indention here is broken thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch --cS+Y9K/79EVUS3Mf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ/aKVgAKCRBhHseHBAsP q2IfAJ0dSvswt01d7DwCTGK8RmwYIlNYEACgkxzpCZG1tBHjsk3Wn1R+58WOhGA= =Nsj7 -----END PGP SIGNATURE----- --cS+Y9K/79EVUS3Mf-- --===============5680302820521932530== 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". --===============5680302820521932530==--