Improve the sync between AirPlay and movies like YouTube. Not sure we understand the negotiation for syncing.

This commit is contained in:
Mike Brady
2017-12-10 22:26:19 +00:00
parent c803a96f24
commit 86f76ad6ce
3 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ typedef struct {
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
+2 -2
View File
@@ -227,10 +227,10 @@ void *rtp_control_receiver(void *arg) {
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);
}
}
+3 -1
View File
@@ -765,11 +765,12 @@ static void handle_setup(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *
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.",
@@ -780,6 +781,7 @@ static void handle_setup(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *
"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);
}