fix(timing): Fix --goptime producing compressed timestamps (Test 163)

When using --goptime, timestamps were compressed to 00:00:01-02 instead
of actual GOP times (17:56:40-47). This was caused by conflicts between:
- GOP timing set from GOP headers (wall-clock time, e.g., 17:56:40)
- PES PTS timing (stream-relative time, e.g., 00:00:02)

The sync detection saw these as 64,598-second "jumps" and kept resetting
timing, corrupting the output.

Fixes:
1. Guard video PES timing in general_loop.c - skip set_current_pts and
   set_fts when use_gop_as_pts == 1 to prevent PES PTS from overwriting
   GOP-based timing
2. Disable sync check in ccextractor.c when use_gop_as_pts == 1 since
   GOP time and PES PTS are in different time bases and sync detection
   is meaningless

Test results:
- Before: 00:00:01,231 --> 00:00:01,729
- After:  17:56:41,319 --> 17:56:43,084

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Carlos Fernandez
2025-12-21 12:34:05 +01:00
parent 25d68b75bd
commit 94a43928ad
2 changed files with 14 additions and 2 deletions

View File

@@ -186,6 +186,11 @@ int start_ccx()
ccx_options.use_gop_as_pts = 0;
if (ccx_options.ignore_pts_jumps)
ccx_common_timing_settings.disable_sync_check = 1;
// When using GOP timing (--goptime), disable sync check because
// GOP time (wall-clock) and PES PTS (stream-relative) are in
// different time bases and will always appear as huge jumps.
if (ccx_options.use_gop_as_pts == 1)
ccx_common_timing_settings.disable_sync_check = 1;
mprint("\rAnalyzing data in general mode\n");
tmp = general_loop(ctx);
if (!ret)

View File

@@ -1018,8 +1018,15 @@ int process_non_multiprogram_general_loop(struct lib_ccx_ctx *ctx,
pts = data_node_video->pts;
}
set_current_pts(dec_ctx_video->timing, pts);
set_fts(dec_ctx_video->timing);
// When using GOP timing (--goptime), timing is set from GOP headers
// in gop_header(), not from PES PTS. Skip PTS-based timing here
// to avoid conflicts between GOP time (absolute time-of-day) and
// PTS (relative stream time) that cause sync detection failures.
if (ccx_options.use_gop_as_pts != 1)
{
set_current_pts(dec_ctx_video->timing, pts);
set_fts(dec_ctx_video->timing);
}
}
size_t got = process_m2v(*enc_ctx, dec_ctx_video, data_node_video->buffer, data_node_video->len, dec_sub_video);
if (got > 0)