if (do_wait == 0)
if ((conn->ab_synced != 0) && (conn->ab_read == conn->ab_write)) { // the buffer is empty!
if (notified_buffer_empty == 0) {
- debug(1, "Buffers exhausted.");
+ debug(3, "Buffers exhausted.");
notified_buffer_empty = 1;
// reset_input_flow_metrics(conn); // don't do a full flush parameters reset
conn->initial_reference_time = 0;
response = clock_no_master;
}
} else {
- response = clock_version_mismatch;
+ // the version can not be zero. If zero is returned here, it means that the shared memory is not yet initialised, so not availalbe
+ if (nqptp_data.version == 0)
+ response = clock_service_unavailable;
+ else
+ response = clock_version_mismatch;
}
} else {
response = clock_data_unavailable;
obfp += 2;
};
*obfp = 0;
-
-
+
+
// get raw timestamp information
// I think that a good way to understand these timestamps is that
// (1) the rtlt below is the timestamp of the frame that should be playing at the
// Thus, (3) the latency can be calculated by subtracting the second from the
// first.
// There must be more to it -- there something missing.
-
+
// In addition, it seems that if the value of the short represented by the second
// pair of bytes in the packet is 7
// then an extra time lag is expected to be added, presumably by
// the AirPort Express.
-
+
// Best guess is that this delay is 11,025 frames.
-
+
uint32_t rtlt = nctohl(&packet[4]); // raw timestamp less latency
uint32_t rt = nctohl(&packet[16]); // raw timestamp
-
+
uint32_t fl = nctohs(&packet[2]); //
-
+
debug(1,"Sync Packet of %d bytes received: \"%s\", flags: %d, timestamps %u and %u,
giving a latency of %d frames.",plen,obf,fl,rt,rtlt,rt-rtlt);
//debug(1,"Monotonic timestamps are: %" PRId64 " and %" PRId64 "
finished = 1;
}
} while (finished == 0);
- debug(1, "Connection %d: AP2 Event Receiver RTP thread \"normal\" exit.",
- conn->connection_number);
pthread_cleanup_pop(1); // close the socket
-
pthread_cleanup_pop(1); // do the cleanup
- debug(1, "Connection %d: AP2 Event Receiver RTP thread exit.", conn->connection_number);
+ debug(2, "Connection %d: AP2 Event Receiver RTP thread \"normal\" exit.", conn->connection_number);
pthread_exit(NULL);
}
#else
} else if (config.allow_session_interruption == 1) {
#endif
- debug(1, "Connection %d: Asking Connection %d to stop playing.", conn->connection_number,
+ debug(2, "Connection %d: Asking Connection %d to stop playing.", conn->connection_number,
playing_conn->connection_number);
playing_conn->stop = 1;
interrupting_current_session = 1;
}
if ((have_the_player == 1) && (interrupting_current_session == 1)) {
- debug(1, "Connection %d: got player lock", conn->connection_number);
+ debug(2, "Connection %d: Got player lock", conn->connection_number);
response = 1;
} else {
debug(1, "Connection %d: failed to get player lock", conn->connection_number);
debug(2, "Connection %d: Stop playing.", conn->connection_number);
conn->ap2_play_enabled = 0;
// not sure this is needed yet
- reset_anchor_info(conn); // needed if the player resumes
+ // reset_anchor_info(conn); // needed if the player resumes
}
pthread_cleanup_pop(1); // unlock the conn->flush_mutex