Fix: eliminate false epoch drop reports on TX sessions#1478
Draft
Fix: eliminate false epoch drop reports on TX sessions#1478
Conversation
Use cur_epochs == 0 as sentinel for uninitialized pacing state in all four TX types (video, audio, ancillary, fast metadata). On first frame, start from the current PTP epoch instead of stale values, removing the init_pacing_epoch callbacks. When user provides timestamps (required_tai), skip epoch drop accounting since the library was incorrectly penalizing scheduler jitter as drops. Video/ancillary: keep user-derived frame_count in the late-frame branch. Audio/fastmetadata: skip the epochs > next_epochs drop counter. In RxTxApp, initialize base_tai_time from PTP after mtl_start() so frame threads only stamp frames once the scheduler is running. Fixes: #1378 Signed-off-by: Kasiewicz, Marek <[email protected]>
Add TX-only epoch drop tests for all three pipeline types. Each test sends frames for 5 seconds and asserts stat_epoch_drop == 0. Both non-user-pacing and user-pacing (TAI +20ms) variants are included. New tests: St20p.tx_no_epoch_drop St20p.tx_user_pacing_no_epoch_drop St30p.tx_no_epoch_drop St30p.tx_user_pacing_no_epoch_drop St40p.tx_no_epoch_drop St40p.tx_user_pacing_no_epoch_drop Signed-off-by: Kasiewicz, Marek <[email protected]>
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.
Problem: TX sessions (st20/st30/st40/st41) falsely reported epoch drops in two scenarios:
First frame after session creation pacing state was uninitialized (stale zero values vs PTP time ~10^11)
User-pacing mode library compared current PTP wall-clock against the next free slot, penalizing scheduler jitter as dropped epochs even though the user's timestamp was valid
Fix:
Use cur_epochs == 0 as uninitialized sentinel; on first frame, start from current PTP epoch
When required_tai is set (user controls pacing), skip epoch drop accounting — video/ancillary keep user-derived frame_count, audio/fastmetadata skip the epochs > next_epochs counter
In RxTxApp, initialize base_tai_time from PTP after mtl_start() so frame threads don't stamp frames before the scheduler is running
Tests: Added TX-only epoch drop tests for st20p, st30p, st40p both with and without user_pacing (6 tests total, all pass with 0 drops).
Fixes #1378