Skip to content

Commit

Permalink
Merge pull request Upipe#14 from kierank/srt-new
Browse files Browse the repository at this point in the history
srth: Add comments to clarify latency negotiation logic
  • Loading branch information
funman committed Jun 13, 2024
2 parents ff8f006 + a34c94c commit cb4d213
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/upipe-srt/upipe_srt_handshake.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ struct upipe_srt_handshake {
uint32_t mfw;


uint16_t receiver_tsbpd_delay;
uint16_t receiver_tsbpd_delay; /* stores negotiated latency */
uint16_t sender_tsbpd_delay;
uint32_t flags;
uint16_t major;
Expand Down Expand Up @@ -829,6 +829,7 @@ static void upipe_srt_handshake_parse_hsreq(struct upipe *upipe, const uint8_t *
(flags & SRT_HANDSHAKE_EXT_FLAG_PACKET_FILTER) ? "PACKET_FILTER " : "");
upipe_srt_handshake->flags = flags;

/* Latency is MAX(sender_tsbpd_delay, receiver_tsbpd_delay). Arbitrarily use receiver_tsbpd_delay variable as the latency */
uint16_t receiver_tsbpd = upipe_srt_handshake->receiver_tsbpd_delay;

upipe_srt_handshake->receiver_tsbpd_delay = srt_get_handshake_extension_receiver_tsbpd_delay(ext);
Expand All @@ -839,7 +840,7 @@ static void upipe_srt_handshake_parse_hsreq(struct upipe *upipe, const uint8_t *
if (upipe_srt_handshake->receiver_tsbpd_delay < receiver_tsbpd)
upipe_srt_handshake->receiver_tsbpd_delay = receiver_tsbpd;

upipe_dbg_va(upipe, "latency receiver %u", upipe_srt_handshake->receiver_tsbpd_delay);
upipe_dbg_va(upipe, "Negotiated latency %u ms", upipe_srt_handshake->receiver_tsbpd_delay);
}

static bool upipe_srt_handshake_parse_kmreq(struct upipe *upipe, const uint8_t *ext, const size_t ext_len, const uint8_t **wrap, uint8_t *wrap_len)
Expand Down

0 comments on commit cb4d213

Please sign in to comment.