PR #25720 opened by romainhedouin URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25720 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25720.patch
last_ty_pts is only written, never read. Remove it and the code that updates it. last_ty_pts has been unused since the demuxer was added in 2017 (a6a6935ee8) -O3 does not currently optimize this: with GCC, this patch makes ty_read_packet() go from 593 to 578 instructions. The output is byte-identical on 6636 generated TY streams, 6400 of them damaged. Noticed during a review sweep of ffmpeg using an LLM. Signed-off-by: romainhedouin <[email protected]> <!-- If this PR requires new FATE test samples, attach them to the PR and list their target paths below (relative to the fate-suite root). Attached filenames must match the sample's filename: ```fate-samples # e.g. vorbis/new-sample.ogg ``` --> >From df8a9e79fd0e14a42fb213e4f8dcca68ac30df40 Mon Sep 17 00:00:00 2001 From: romainhedouin <[email protected]> Date: Tue, 3 Nov 2026 12:14:53 +0100 Subject: [PATCH] avformat/ty: remove the unused last_ty_pts field last_ty_pts is only written, never read. Remove it and the code that updates it. The output is unchanged. Noticed during a review sweep of ffmpeg using an LLM. Signed-off-by: romainhedouin <[email protected]> --- libavformat/ty.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/libavformat/ty.c b/libavformat/ty.c index 842d97038cb..c677cdf6e11 100644 --- a/libavformat/ty.c +++ b/libavformat/ty.c @@ -87,7 +87,6 @@ typedef struct TYDemuxContext { uint8_t pes_buffer[20]; /* holds incomplete pes headers */ int pes_buf_cnt; /* how many bytes in our buffer */ size_t ac3_pkt_size; /* length of ac3 pkt we've seen so far */ - uint64_t last_ty_pts; /* last TY timestamp we've seen */ int64_t first_audio_pts; int64_t last_audio_pts; @@ -452,18 +451,6 @@ static int demux_video(AVFormatContext *s, TyRecHdr *rec_hdr, AVPacket *pkt) if (subrec_type != 0x02) { if (subrec_type == 0x0c && pkt->size >= 6) pkt->data[5] |= 0x08; - if (subrec_type == 0x07) { - ty->last_ty_pts = rec_hdr->ty_pts; - } else { - /* yes I know this is a cheap hack. It's the timestamp - used for display and skipping fwd/back, so it - doesn't have to be accurate to the millisecond. - I adjust it here by roughly one 1/30 sec. Yes it - will be slightly off for UK streams, but it's OK. - */ - ty->last_ty_pts += 35000000; - //ty->last_ty_pts += 33366667; - } /* set PTS for this block before we send */ if (ty->last_video_pts > AV_NOPTS_VALUE) { pkt->pts = ty->last_video_pts; -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
