Improve the sync between AirPlay and movies like YouTube. Not sure we understand the negotiation for syncing.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user