Skip to content

Commit

Permalink
srt_tx: sets proper latency after handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
funman committed Jun 7, 2024
1 parent d9b7612 commit ff8f006
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/srt_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,25 @@ static void stop(struct upump *upump);
static int catch_hs(struct uprobe *uprobe, struct upipe *upipe,
int event, va_list args)
{
uint16_t latency_ms;

switch (event) {
case UPROBE_SOURCE_END:
upipe_warn(upipe, "Remote shutdown");
struct upump *u = upump_alloc_timer(upump_mgr, stop, upipe_udpsrc,
NULL, UCLOCK_FREQ, 0);
upump_start(u);
return uprobe_throw_next(uprobe, upipe, event, args);
case UPROBE_NEW_FLOW_DEF:
if (!ubase_check(upipe_srt_handshake_get_latency(upipe, &latency_ms)))
upipe_err(upipe, "Couldn't get latency");
else {
upipe_notice_va(upipe, "Latency %hu ms", latency_ms);
char latency_ms_str[16];
snprintf(latency_ms_str, sizeof(latency_ms_str), "%hu", latency_ms);
if (!ubase_check(upipe_set_option(upipe_srt_sender, "latency", latency_ms_str)))
upipe_err(upipe, "Couldn't set sender latency");
}
}
return uprobe_throw_next(uprobe, upipe, event, args);
}
Expand Down

0 comments on commit ff8f006

Please sign in to comment.