avcodec/vc1_parser: report no picture type until one has been read #24439
No reviewers
Labels
No labels
avcodec
avdevice
avfilter
avformat
avutil
backport/release/4.3
backport/release/4.4
backport/release/5.0
backport/release/5.1
backport/release/6.0
backport/release/6.1
backport/release/7.0
backport/release/7.1
backport/release/8.0
backport/release/8.1
backport/release/9.0
backport/release/9.1
CLI
doc
Forgejo Fairy
swresample
swscale
vulkan
API
API major
bug
enhancement
fix/bug
fix/regression
GSoC
GSoC-Qualification
help wanted
important
LGTM
meta
needs backport
needs docs
needs fate test
needs info
needs sample
needs testing
new
question
regression
repro
flaky
repro
no
repro
no(env)
repro
yes
resolution
duplicate
resolution
external
resolution
fixed
resolution
invalid
resolution
wontfix
security
small
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
FFmpeg/FFmpeg!24439
Loading…
Reference in a new issue
No description provided.
Delete branch "superuser404/FFmpeg:vc1-parser-picture-type"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
av_parser_init()leavespict_typeatAV_PICTURE_TYPE_I, andvc1_parseronly sets it whenvc1_extract_header()extracts a frame header. A track whose frames carry no start codes never gives it one, so the default stands for the whole stream, and the parse path inlibavformat/demux.cmarks a packet a key frame when the parser reportsAV_PICTURE_TYPE_Iwithkey_frameunset. Every packet of such a track therefore leaves the demuxer flagged as a key frame.Matroska is where this shows up, since
matroska_parse_block()requestsAVSTREAM_PARSE_HEADERSfor a VC-1 track while the frames are stored without start codes.Reproduction
-fflags +noparse(the container's own flags)Ten is what the file carries: the Cues list ten entries, at those same timestamps.
What the change does not touch
A track this parser can read is unaffected, because there it sets the picture type per frame. The two shapes that could regress both hold:
.vc1elementary stream carries no container flags at all, and still reports its single key frame from the parser (measured onvc1/SA10143.vc1andvc1/ilaced_twomv.vc1, unchanged at 1);FATE
All nine vc1 tests pass:
fate-vc1(sa00040,sa00050,sa10091,sa10143,sa20021,ilaced_twomv),fate-vc1test_smm0005,fate-vc1test_smm0015,fate-vc1-ism.LLM-GPT-6-ASTRA: The fix in
3e9abaf05alooks correct, with two non-blocking suggestions.The assignment takes effect after the generic parser initialization sets
AV_PICTURE_TYPE_I. Withkey_frame == -1,AV_PICTURE_TYPE_NONEselects the existing container-keyframe fallback inparse_packet(). Successful frame-header parsing still replaces the initial value. This fixes FFmpeg’s default classification; it is not a workaround for an external bug.Both GPT-6-ASTRA drafts reported successful AArch64 comparisons against the parent, and all three drafts reported nine passing VC-1 FATE tests. I independently confirmed:
make fate-vc1 SAMPLES=/opt/fate-suitepass.-fflags +noparse. Matroska’s PTS, DTS, durations and sizes also match that output; comparing parent and PR, only flags change among these fields in both containers.vc1-wmapro.ism, and Matroska remuxes of each retain identical packet flags, PTS, DTS, durations and sizes between parent and PR.GPT-6-ASTRA (code and design), GLM-5.3 — minor, optional regression coverage. A FATE test recording packet flags from a small Matroska reproduction containing both key and non-key packets would protect this fix. The existing nine tests check decoded
framecrcoutput rather than this input-packet classification. The reproduction’sffprobe -show_entries packet=flagsapproach is suitable, with expected output intests/ref/fate/. If a new sample is needed, send the sample-upload request to samples-request at ffmpeg dot org.GPT-6-ASTRA (design) — minor, explanatory corrections. In the commit message, replace
ff_read_packet()'s parse pathwithparse_packet(). In the PR description, replacematroska_parse_block()withmkv_parse_video(), which requestsAVSTREAM_PARSE_HEADERS.I also checked GLM-5.3’s conditional observations. The proposed missing-index AVI example does not establish a regression:
avi_sync()generates keyframe index entries, and removingidx1from the reproduction leaves all 1,451 packet flags identical before and after this patch. The broader claim of lost seeking remains unverified, with no demonstrated affected input. Also, MOV explicitly requests full parsing for VC-1, so the draft’s explanation that MOV does not parse VC-1 is incorrect.GLM-5.3’s DASH observation is supported by the conditional parsing path: when P-frame fragmentation or trick-mode parsing is active,
NONEsetscoding_dependency, suppressing an unsupportedcodingDependency="false"declaration. That is not an established defect, and requiring stream copy does not make the path unreachable. Its runtime behavior was not independently tested here.I classify this as minor_issues_approve under the supplied rules for minor inconsistencies between explanation and implementation, and for non-blocking suggestions where the PR can merge in its current form. The verified change fixes the reported classification error without a demonstrated regression. The patch-submission checklist asks authors to consider regression tests for existing code; the additional packet-flags test is useful follow-up coverage rather than a reason to block this fix.