struct shm_structure nqptp_data;
if (get_nqptp_data(&nqptp_data) == 0) {
if (nqptp_data.version == NQPTP_SHM_STRUCTURES_VERSION) {
- if (actual_clock_id != NULL)
- *actual_clock_id = nqptp_data.master_clock_id;
- if (raw_offset != NULL)
- *raw_offset = nqptp_data.local_to_master_time_offset;
- response = 0;
+ // assuming a clock id can not be zero
+ if (nqptp_data.master_clock_id != 0) {
+ if (actual_clock_id != NULL)
+ *actual_clock_id = nqptp_data.master_clock_id;
+ if (raw_offset != NULL)
+ *raw_offset = nqptp_data.local_to_master_time_offset;
+ response = 0;
+ } else {
+ debug(1,"clock not valid");
+ response = -2; // clock info not valid
+ }
} else {
if (failure_message_sent == 0) {
warn("This version of Shairport Sync requires an NQPTP with a Shared Memory Interface Version %u, but the installed version is %u. Please install the correct version of NQPTP.", NQPTP_SHM_STRUCTURES_VERSION, nqptp_data.version);
} else if (ptp_status == -1) {
debug(3, "don't have the ptp clock interface");
response = -1;
+ } else if (ptp_status == -2) {
+ debug(1, "ptp clock not valid");
+ response = -1;
} else {
- debug(3, "ptp clock not valid");
+ debug(3, "ptp clock error");
response = -1;
}
return response;
// debug(1,"player buffer size and occupancy: %u and %u", player_buffer_size,
// player_buffer_occupancy);
if (player_buffer_occupancy >
- ((0.5 + 0.1) * 44100.0 / 352)) { // must be greater than the lead time.
+ ((0.25 + 0.1) * 44100.0 / 352)) { // must be greater than the lead time.
// if there is enough stuff in the player's buffer, sleep for a while and try again
// debug(1,"sleep for 20 ms");
usleep(20000); // wait for a while
int64_t lead_time = buffer_should_be_time - get_absolute_time_in_ns();
// debug(1,"lead time in buffered_audio is %f milliseconds.", lead_time * 0.000001);
// ask for 0.5 sec of leadtime
- if ((lead_time >= (int64_t)(0.5 * 1000000000)) || (streaming_has_started == 1)) {
+ if ((lead_time >= (int64_t)(0.25 * 1000000000)) || (streaming_has_started == 1)) {
if (streaming_has_started == 0)
debug(1, "rtp lead time is %f ms.", 0.000001 * lead_time);
streaming_has_started = 1;