if (setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof tv) == -1)
debug(1, "Error %d setting receive timeout for DACP service.", errno);
int ndata = recv(sockfd, buffer, sizeof(buffer), 0);
- debug(3, "Received %d bytes: \"%s\".", ndata, buffer);
+ // debug(3, "Received %d bytes: \"%s\".", ndata, buffer);
if (ndata <= 0) {
debug(1, "dacp_send_command -- error receiving response for command \"%s\".",
command);
if (!conn->ab_buffering) {
// check once, after a short period of has elapsed, assuming 352 frames per packet
- i = ((250 * 44100) / 352) / 1000; // approx 250 ms
+ i = ((125 * 44100) / 352) / 1000; // approx 125 ms
if (i < seq_diff(conn->ab_read, conn->ab_write, conn->ab_read)) {
seq_t next = seq_sum(conn->ab_read, i);
abuf = conn->audio_buffer + BUFIDX(next);
config.output->play(silence, conn->max_frames_per_packet * conn->output_sample_ratio);
} else if (frames_to_drop) {
if (frames_to_drop > 3 * config.output_rate)
- warn("Very large number of frames to drop: %" PRId64 ".",frames_to_drop);
+ warn("Very large number of frames to drop: %" PRId64 ".", frames_to_drop);
debug(3, "%" PRId64 " frames to drop.", frames_to_drop);
frames_to_drop -= inframe->length;
if (frames_to_drop < 0)
(!conn->player_thread_please_stop) && (config.resyncthreshold > 0.0) &&
(abs_sync_error > config.resyncthreshold * config.output_rate)) {
if (abs_sync_error > 3 * config.output_rate) {
- warn("Very large sync error: %" PRId64 " frames, with a delay of %" PRId64 "frames.",sync_error,delay);
+ warn("Very large sync error: %" PRId64 " frames, with delay: %" PRId64
+ ", td_in_frames: %" PRId64 ", rt: %" PRId64 ", nt: %" PRId64
+ ", current_delay: %" PRId64 ", frames.",
+ sync_error, delay, td_in_frames, rt, nt, current_delay);
}
sync_error_out_of_bounds++;
} else {
if (type == 0x56) {
pktp += 4;
plen -= 4;
+ debug(1, "resent packet %u received in audio port.", ntohs(*(uint16_t *)(pktp + 2)));
}
seq_t seqno = ntohs(*(uint16_t *)(pktp + 2));
// increment last_seqno and see if it's the same as the incoming seqno
} else {
debug(1, "Sync packet received before we got a timing packet back.");
}
- } else if (packet[1] == 0xd6) { // resent audio data in the control path -- whaale only?
- // debug(1, "Control Port -- Retransmitted Audio Data Packet received.");
- pktp = packet + 4;
- plen -= 4;
- seq_t seqno = ntohs(*(uint16_t *)(pktp + 2));
+ } else {
+ uint8_t type = packet[1] & ~0x80;
+ if ((type == 0x60) ||
+ (type == 0x56)) { // audio data / resent audio data in the control path -- whaale only?
+ pktp = packet;
+
+ if (type == 0x56) { // resent audio data in the control path -- whaale only?
+ // debug(1, "Control Port -- Retransmitted Audio Data Packet received.");
+ pktp = packet + 4;
+ plen -= 4;
+ }
- int64_t timestamp = monotonic_timestamp(ntohl(*(uint32_t *)(pktp + 4)), conn);
+ seq_t seqno = ntohs(*(uint16_t *)(pktp + 2));
+ if (type == 0x56)
+ debug(1, "Resent audio packet %u received in the control port.", seqno);
+ else
+ debug(1, "Audio packet %u received in the control port.", seqno);
- pktp += 12;
- plen -= 12;
+ int64_t timestamp = monotonic_timestamp(ntohl(*(uint32_t *)(pktp + 4)), conn);
- // check if packet contains enough content to be reasonable
- if (plen >= 16) {
- player_put_packet(seqno, timestamp, pktp, plen, conn);
- continue;
+ pktp += 12;
+ plen -= 12;
+
+ // check if packet contains enough content to be reasonable
+
+ if (plen >= 16) {
+ player_put_packet(seqno, timestamp, pktp, plen, conn);
+ continue;
+ } else {
+ debug(3, "Too-short retransmitted audio packet received in control port, ignored.");
+ }
} else {
- debug(3, "Too-short retransmitted audio packet received in control port, ignored.");
+ debug(1, "Control Port -- Unknown RTP packet of type 0x%02X length %d, ignored.", packet[1],
+ nread);
}
- } else
- debug(1, "Control Port -- Unknown RTP packet of type 0x%02X length %d, ignored.", packet[1],
- nread);
+ }
}
debug(3, "Control RTP thread interrupted. terminating.");