fix: correctly initialize frame type for tx3g and mov_text subtitles - #2321
fix: correctly initialize frame type for tx3g and mov_text subtitles#2321shubhrai23 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes MP4 subtitle timestamp initialization by ensuring subtitle-only tracks (including mov_text/tx3g) get an I-frame picture type so set_fts() can set min_pts from the first sample.
Changes:
- Expand the media-type check so
GF_ISOM_MEDIA_TEXTandGF_ISOM_MEDIA_SUBTtracks also forcecurrent_picture_coding_type = CCX_FRAME_TYPE_I_FRAMEbefore callingset_fts(). - Align MP4 subtitle handling with how
tx3gtracks are already dispatched later in the same loop.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // For caption-only tracks (c608/c708), set frame type to I-frame | ||
| // so that set_fts() will set min_pts from the first sample. | ||
| // Without video frames, frame type would stay Unknown and | ||
| // min_pts would never be set, causing broken timestamps. | ||
| if (type == GF_ISOM_MEDIA_CLOSED_CAPTION) | ||
| if (type == GF_ISOM_MEDIA_CLOSED_CAPTION || type == GF_ISOM_MEDIA_TEXT || type == GF_ISOM_MEDIA_SUBT) |
| // Without video frames, frame type would stay Unknown and | ||
| // min_pts would never be set, causing broken timestamps. | ||
| if (type == GF_ISOM_MEDIA_CLOSED_CAPTION) | ||
| if (type == GF_ISOM_MEDIA_CLOSED_CAPTION || type == GF_ISOM_MEDIA_TEXT || type == GF_ISOM_MEDIA_SUBT) |
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit c328108...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 6077cf5...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
Resolves #2105
What changed: Added \GF_ISOM_MEDIA_TEXT\ and \GF_ISOM_MEDIA_SUBT\ alongside \GF_ISOM_MEDIA_CLOSED_CAPTION\ to properly initialize the picture coding type to \CCX_FRAME_TYPE_I_FRAME\ for subtitle tracks in \mp4.c.
Why: Because \mov_text\ / \ x3g\ subtitles are parsed as text/subt media types rather than closed captions, they previously bypassed the I-frame initialization. Without this, \min_pts\ is never set from the first sample, causing all subsequent timestamps calculated via \set_fts()\ to be offset or incorrectly computed.