time_of_last_audio_packet = get_absolute_time_in_fp();
if (connection_state_to_output) { // if we are supposed to be processing these packets
- if ((flush_rtp_timestamp != 0) &&
+ if (flush_rtp_timestamp != 0)
+ debug(1,"Flush_rtp_timestamp is %u",flush_rtp_timestamp);
+
+// if ((flush_rtp_timestamp != 0) &&
+ if ((0) &&
((timestamp == flush_rtp_timestamp) || seq32_order(timestamp, flush_rtp_timestamp))) {
debug(2, "Dropping flushed packet in player_put_packet, seqno %u, timestamp %u, flushing to "
"timestamp: %u.",
}
void player_flush(uint32_t timestamp) {
- // debug(1,"Flush requested up to %u. It seems as if 0 is special.",timestamp);
+ debug(1,"Flush requested up to %u. It seems as if 0 is special.",timestamp);
pthread_mutex_lock(&flush_mutex);
flush_requested = 1;
// if (timestamp!=0)
rtp_timestamp_less_latency = ntohl(*((uint32_t *)&packet[4]));
sync_rtp_timestamp = ntohl(*((uint32_t *)&packet[16]));
+
+ debug(1,"Latency is %u frames.",sync_rtp_timestamp-rtp_timestamp_less_latency);
if (packet[0] & 0x10) {
// if it's a packet right after a flush or resume
static void handle_record(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
debug(1,"Handle Record");
resp->respcode = 200;
+ // I think this is for telling the client what the asbsolute minimum latency actually is,
+ // and when the client specifies a latency, it should be added to this figure.
+
+ // Thus, AirPlay's latency figure of 77175, when added to 11025 gives you exactly 88200
+ // and iTunes' latency figure of 88553, when added to 11025 gives you 99578, pretty close to the 99400 we guessed.
+
msg_add_header(resp, "Audio-Latency", "88200");
char *p;
p = strstr(hdr, "rtptime=");
if (p) {
p = strchr(p, '=') + 1;
- if (p)
+ if (p) {
rtptime = uatoi(p); // unsigned integer -- up to 2^32-1
+ rtptime--;
+ // debug(1,"RTSP Flush Requested by handle_record: %u.",rtptime);
+ player_flush(rtptime);
+ }
}
}
- rtptime--;
- debug(1,"RTSP Flush Requested by handle_record: %u.",rtptime);
- player_flush(rtptime);
}
static void handle_options(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {