RAOP packet builders: audio (PT 0x60), control sync (0xd4), and timing
response (0xd3). All multi-byte fields are big-endian.
Summary
Functions
An audio RTP packet: 80 [60|e0] seq ts ssrc <payload>. marker? sets the
marker bit (0xe0) on the first packet of a stream.
A control sync packet (PT 0x54). rtp_now is the current RTP timestamp,
latency the buffer in samples (RAOP default 88200 = 2 s), ntp the NTP time.
first? sets the 0x90 lead byte on the first sync of a stream (else 0x80).
Parse the transmit (origin) NTP timestamp out of a timing request (PT 0x52).
A timing response (PT 0x53) to a received timing request. origin is the
request's transmit timestamp; recv/xmit are our NTP receive/send times.
Functions
@spec audio( non_neg_integer(), non_neg_integer(), non_neg_integer(), binary(), boolean() ) :: binary()
An audio RTP packet: 80 [60|e0] seq ts ssrc <payload>. marker? sets the
marker bit (0xe0) on the first packet of a stream.
@spec sync(non_neg_integer(), non_neg_integer(), non_neg_integer(), boolean()) :: binary()
A control sync packet (PT 0x54). rtp_now is the current RTP timestamp,
latency the buffer in samples (RAOP default 88200 = 2 s), ntp the NTP time.
first? sets the 0x90 lead byte on the first sync of a stream (else 0x80).
@spec timing_request_origin(binary()) :: {:ok, non_neg_integer()} | :error
Parse the transmit (origin) NTP timestamp out of a timing request (PT 0x52).
@spec timing_response(non_neg_integer(), non_neg_integer(), non_neg_integer()) :: binary()
A timing response (PT 0x53) to a received timing request. origin is the
request's transmit timestamp; recv/xmit are our NTP receive/send times.