typedef struct {
int connection_number; // for debug ID purposes, nothing else...
-
+ int64_t staticLatencyCorrection; // it seems iTunes needs some offset before it's more or less right. Odd.
#if defined(HAVE_DBUS) || defined(HAVE_MPRIS)
enum session_status_type play_state;
#endif
sync_rtp_timestamp = monotonic_timestamp(ntohl(*((uint32_t *)&packet[16])), conn);
if (config.use_negotiated_latencies) {
- int64_t la = sync_rtp_timestamp - rtp_timestamp_less_latency + 11025;
+ int64_t la = sync_rtp_timestamp - rtp_timestamp_less_latency + conn->staticLatencyCorrection;
if (la != config.latency) {
config.latency = la;
- // debug(1,"Using negotiated latency of %u frames.",config.latency);
+ debug(1,"Using negotiated latency of %lld frames and a static latency correction of %lld",sync_rtp_timestamp - rtp_timestamp_less_latency,conn->staticLatencyCorrection);
}
}
else
debug(2, "iTunes Version Number not found.");
if (iTunesVersion >= 10) {
- debug(2, "User-Agent is iTunes 10 or better, (actual version is %d); "
+ debug(1, "User-Agent is iTunes 10 or better, (actual version is %d); "
"selecting the iTunes "
"latency of %d frames.",
iTunesVersion, config.iTunesLatency);
config.latency = config.iTunesLatency;
+ conn->staticLatencyCorrection = 11025;
}
} else if (strstr(ua, "AirPlay") == ua) {
debug(2, "User-Agent is AirPlay; selecting the AirPlay latency of %d frames.",
"of %d frames.",
config.ForkedDaapdLatency);
config.latency = config.ForkedDaapdLatency;
+ conn->staticLatencyCorrection = 11025;
} else {
debug(2, "Unrecognised User-Agent. Using latency of %d frames.", config.latency);
}