Skip to main content

Module sync

Module sync 

Source
Expand description

Audio/video sync harness (M-MEDIA.7 / AUT-103).

Combines GstreamerAudioCapture and GstreamerVideoCapture into one harness that reports per-stream timing and inter-stream drift. Synthetic audiotestsrc + videotestsrc sources keep the assertion deterministic — live capture (M-MEDIA.15 / .16) will reuse the same harness shape but with autoaudiosrc / autovideosrc.

§What “drift” means here

Each stream stamps its own PTS via MediaTime::from_sample / MediaTime::from_frame. For synthetic sources, both PTS values are derived from per-stream counters at construction-time rates, so the per-stream PTS is the timeline. We report:

  • first_audio_pts / first_video_pts (≈ 0 s for synthetic sources).
  • last_audio_pts / last_video_pts (= sample_count / rate and frame_count / fps respectively).
  • drift = |last_audio_pts - last_video_pts|. For synthetic sources this is near-zero by construction; for live sources it reports the underlying clock disagreement.

Structs§

SyncConfig
Tunable parameters for one harness run.
SyncReport
Result of a single run capture.

Enums§

Error
Failure modes for the sync harness.

Functions§

run
Run one capture cycle. Spawns both audio + video sources, pulls audio chunks at audio_chunk_frames granularity and one video frame per video tick until duration is covered. Returns the summary SyncReport.
seconds_to_count 🔒
Convert seconds × rate to a u64 count, rounding to nearest. Both inputs are finite + non-negative in normal use; clamps to 0 on anything else.