Debian Codegraph @

src/rist-retx-domain.h

raw symbols SCIP
1 /* librist. SPDX-License-Identifier: BSD-2-Clause
2 *
3 * Retransmission sequence-domain predicate. An Advanced-context sender
4 * indexes its retransmit buffer by the 32-bit advanced sequence, but a
5 * peer that has negotiated down to Main (TR-06-3 ยง9: an Advanced device
6 * starts each peer in Main and only frames Advanced once the peer
7 * advertises I=1) requests retransmits with a 16-bit RTP sequence
8 * (nack_seq_msb = 0). Those two sequence spaces are independent
9 * counters, so a Main peer's NACK never resolves against the 32-bit
10 * index and its losses are never retransmitted. This predicate decides,
11 * per outgoing retransmission, whether to resolve/verify/frame it in the
12 * 16-bit RTP domain instead. Kept standalone so it can be unit-tested
13 * without constructing peers or starting threads.
14 */
15
16 #ifndef RIST_RETX_DOMAIN_H
17 #define RIST_RETX_DOMAIN_H
18
19 #include <stdbool.h>
20
21 #include "librist/headers.h" /* enum rist_profile */
22
23 /* True when a retransmission for a peer must be resolved in the 16-bit
24 * RTP sequence domain rather than the 32-bit advanced domain: only an
25 * Advanced-context sender serving a peer that has NOT negotiated up to
26 * Advanced. Every other case (Advanced<->Advanced, or a Main/Simple
27 * context whose primary index is already the RTP domain) returns false,
28 * so the established paths are unchanged. */
29 static inline bool rist_retx_use_rtp_domain(enum rist_profile ctx_profile,
30 bool remote_supports_advanced)
31 {
32 return ctx_profile == RIST_PROFILE_ADVANCED && !remote_supports_advanced;
33 }
34
35 #endif /* RIST_RETX_DOMAIN_H */