From 18a62f164c7cceaaca3247ec1fb3a6b816f73683 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 7 Aug 2010 20:22:08 +0200 Subject: Update sync info. --- airtunes2.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/airtunes2.rst b/airtunes2.rst index d21e18a..b43b106 100644 --- a/airtunes2.rst +++ b/airtunes2.rst @@ -168,8 +168,8 @@ This is an NTP Timestamp as described in RFC 3450 Section 4. and RFC 1305 :: - /* sizeof(RtpTime) == 8 */ - struct RtpTime { + /* sizeof(NtpTime) == 8 */ + struct NtpTime { /* Seconds since 1900-01-01 00:00:00 (TODO: Timezone?) */ uint32_t integer; @@ -209,9 +209,9 @@ SyncPacket /* sizeof(SyncPacket) == 20 */ struct SyncPacket { RtpHeader header; - RtpTimestamp timestamp; - NtpTime some_time; - RtpTimestamp next_timestamp; + RtpTimestamp now_minus_latency; + NtpTime time_last_sync; + RtpTimestamp now; } @@ -502,17 +502,17 @@ Sync ---- Sync packets are sent once per second or when adding a speaker. They are sent -to the device control port as UDP packets. The next_timestamp field corresponds -to the RTP timestamp of the next audio packet that will be sent. +to the device control port as UDP packets. The timestamp argument corresponds +to the RTP timestamp of the next audio packet that will be sent. The latency +argument is gathered from the Audio-Latency RTSP header. -TODO: More details such as timing adjustments. Sending sync packet ~~~~~~~~~~~~~~~~~~~ :: - send_sync(uint32_t timestamp, bool first) { + send_sync(uint32_t timestamp, uint32_t latency, bool first) { SyncPacket packet; packet.header.payload_type = PAYLOAD_SYNC; packet.header.marker = True; @@ -521,10 +521,10 @@ Sending sync packet if (first) { packet.header.extension = True; } - - packet.now_timestamp = /* TODO: RTP timestamp taking into account latency? */; - packet.next_timestamp = current_rtp_timestamp; /* RTP Timestamp that will be used for the next RTP audio packet */ - packet.some_time = /* TODO: an NTP timestamp */ + + packet.now_minus_latency = timestamp - latency; + packet.now = timestamp; + packet.time_last_sync = time_of_last_sync_packet; } -- cgit v1.2.3-59-g8ed1b