PR #25717 opened by romainhedouin URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25717 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25717.patch
DVDemuxContext.frames is only written, never read. Remove it, the c->frames++ in avpriv_dv_produce_packet() and the av_rescale_q() call in ff_dv_ts_reset() that set it. It has been unused since 0ed1eeb744 (2023) which removed its last reader. -O3 did not remove them: with GCC, ff_dv_ts_reset() goes from 41 to 30 instructions and from 2 av_rescale_q() calls to 1. The output is identical on 17 inputs (raw DV, type-1 AVI and MOV with DV audio), including packet dumps, -c copy remuxes, decodes, seeks and 6000 corrupted streams. 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 964f2e794af1158d5a2ca590b5942d5a67c5c311 Mon Sep 17 00:00:00 2001 From: romainhedouin <[email protected]> Date: Tue, 3 Nov 2026 12:17:00 +0100 Subject: [PATCH] avformat/dv: remove the unused frames counter DVDemuxContext.frames is only written, never read. Remove it, together with the av_rescale_q() call that set it in ff_dv_ts_reset(). The output is unchanged. Noticed during a review sweep of ffmpeg using an LLM. Signed-off-by: romainhedouin <[email protected]> --- libavformat/dv.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libavformat/dv.c b/libavformat/dv.c index 84677284bdf..14d7462bc4b 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -70,7 +70,6 @@ struct DVDemuxContext { struct DVPacket audio_pkt[4]; uint8_t audio_buf[4][8192]; int ach; - int frames; int64_t next_pts_video; int64_t next_pts_audio; @@ -494,8 +493,6 @@ int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, c->next_pts_video += pkt->duration; } - c->frames++; - return size; } @@ -524,8 +521,6 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c, void ff_dv_ts_reset(DVDemuxContext *c, int64_t ts) { - c->frames = !c->sys ? 0 : - av_rescale_q(ts, c->vst->time_base, c->sys->time_base); c->next_pts_video = ts; c->next_pts_audio = (!c->sys || !c->ast[0]) ? AV_NOPTS_VALUE : av_rescale_q(ts, c->vst->time_base, c->ast[0]->time_base); -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
