Skip to content

Commit b4bed8c

Browse files
Fix: User controlled pacing sync for st2110-20
A mechanism that allows the session to move the pacing window if the current epoch is just a little bit behind was applied to user controlled pacing, which in turn made the scenarios where big PTP updates or other small issues may cause incremental delays, which is not really a problem as long as we don't enable user controlled pacing. Fix it by ignoring all discrepancies for user controlled pacing scenarios (required_tai) and just forcing the session to send the packets asap.
1 parent 9168009 commit b4bed8c

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

lib/src/st2110/st_tx_video_session.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,12 @@ static int tv_sync_pacing(struct mtl_main_impl* impl, struct st_tx_video_session
611611
epochs = required_tai / frame_time;
612612
dbg("%s(%d), required tai %" PRIu64 " ptp_epochs %" PRIu64 " epochs %" PRIu64 "\n",
613613
__func__, idx, required_tai, ptp_epochs, epochs);
614-
if (epochs < ptp_epochs) s->stat_error_user_timestamp++;
614+
if (epochs < ptp_epochs) {
615+
info("ptp time - required tai == %" PRIu64 "ms, "
616+
"ptp_epochs %" PRIu64 " epochs %" PRIu64 "\n",
617+
(ptp_time - required_tai) / 1000 / 1000, ptp_epochs, epochs);
618+
s->stat_error_user_timestamp++;
619+
}
615620
} else {
616621
epochs = ptp_time / frame_time;
617622
}
@@ -645,25 +650,26 @@ static int tv_sync_pacing(struct mtl_main_impl* impl, struct st_tx_video_session
645650
", ptp_time %" PRIu64 "ms\n",
646651
__func__, idx, to_epoch, epochs, pacing->cur_epochs, ptp_time / 1000 / 1000);
647652
s->stat_epoch_troffset_mismatch++;
648-
epochs++; /* assign to next */
649-
start_time_ptp = pacing_start_time(pacing, epochs);
650-
to_epoch = start_time_ptp - ptp_time;
651-
}
652653

653-
if (to_epoch < 0) {
654-
/* should never happen */
655-
err("%s(%d), error to_epoch %f, ptp_time %" PRIu64 ", epochs %" PRIu64 " %" PRIu64
656-
"\n",
657-
__func__, idx, to_epoch, ptp_time, epochs, pacing->cur_epochs);
658-
to_epoch = 0;
654+
/* in case of user controlled pacing we need to send this even if late
655+
as close to the user defiend time as possible*/
656+
if (required_tai) {
657+
to_epoch = 0;
658+
} else {
659+
to_epoch = start_time_ptp - ptp_time;
660+
epochs++; /* assign to next */
661+
start_time_ptp = pacing_start_time(pacing, epochs);
662+
}
659663
}
660664

661665
if (epochs > next_epochs) {
662666
dbg("%s(%d), epochs %" PRIu64 " next_epochs %" PRIu64 "\n", __func__, idx, epochs,
663667
next_epochs);
664668
s->stat_epoch_drop += (epochs - next_epochs);
665669
}
670+
666671
if (epochs < next_epochs) s->stat_epoch_onward += (next_epochs - epochs);
672+
667673
pacing->cur_epochs = epochs;
668674
pacing->cur_epoch_time = pacing_time(pacing, epochs);
669675
pacing->rtp_time_stamp = pacing_time_stamp(s, pacing, epochs);

0 commit comments

Comments
 (0)