Repository navigation
[FIX] Fix zero timestamps for GXF/MXF ancillary captions - #2390
Merged
Merged
Conversation
GXF and MXF hand caption data to process_data() as CCX_RAW_TYPE buffers with no video frames to anchor the timing. The caller has already run set_current_pts() for each packet, which sets pts_set to 1, and set_fts() only reaches MinPtsSet after seeing a video frame type, so the CCX_RAW_TYPE branch's "pts_set == 0" check never fired and min_pts was never established. fts stayed at 0, every GXF ancillary cue had zero length and SRT output was empty; MXF's first cues were stamped 0 until timing was set some seconds in. Establish min_pts in that branch whenever MinPtsSet hasn't been reached, and take it from timing->current_pts, which the caller has already rescaled to 90 kHz (data_node->pts is in GXF frame units).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In raising this pull request, I confirm the following (please check boxes):
Reason for this PR:
Sanity check:
Repro instructions:
Generate the synthetic GXF from #2373 (
python3 gen_gxf_anc.py anc.gxf, one CEA-608 caption in an SMPTE 291 ancillary track) and runccextractor anc.gxf --out=srt -o out.srt. On master nothing is written ("Deleted empty output file"); with this PR:00:00:00,401 --> 00:00:02,468 GXF ANC TEST.GXF and MXF hand caption data to
process_data()asCCX_RAW_TYPEbuffers, with no video frames to anchor the timing. The caller has already calledset_current_pts()for the packet, which setspts_setto 1, andset_fts()only reaches MinPtsSet after seeing a video frame type — so theCCX_RAW_TYPEbranch'spts_set == 0check never fired andmin_ptswas never established.ftsstayed at 0, so every GXF ancillary cue had zero length and SRT output was empty; on MXF the first cues were stamped 0 until timing got established a few seconds in.This sets
min_ptsin that branch whenever MinPtsSet hasn't been reached, fromtiming->current_pts(already rescaled to 90 kHz by the caller;data_node->ptsis in GXF frame units).Only GXF and MXF reach this: the third
CCX_RAW_TYPEproducer, the FFmpeg integration, never sets a PTS, andCCX_RAWinputs (DVR-MS/ASF, RCWT) use a different branch.On a real MXF sample, the first two cues (608 at 0.001/2.486, 708 at 0.001/0.001) become 0.667/2.803 and 0.533/2.803, now agreeing between 608 and 708; all later cues are unchanged. Local GXF, MXF, raw, bin and RCWT samples are otherwise byte-identical to master, and ASan is clean.