Look for at least 0.1 seconds of leadtime, ensure a master clock is at least 0.275 seconds old before use, quieten a few debug messages.

This commit is contained in:
Mike Brady
2021-12-07 12:09:49 +00:00
parent 70821f8127
commit 3de7e9a5c5
3 changed files with 11 additions and 10 deletions
+3 -2
View File
@@ -1062,8 +1062,9 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) {
conn->first_packet_time_to_play = should_be_time;
int64_t lt = conn->first_packet_time_to_play - local_time_now;
debug(1, "Connection %d: Lead time for first frame %" PRId64 ": %f seconds.",
if (lt < 100000000)
debug(1, "Connection %d: Short lead time for first frame %" PRId64 ": %f seconds.",
conn->connection_number, conn->first_packet_timestamp, lt * 0.000000001);
int64_t lateness = local_time_now - conn->first_packet_time_to_play;
+3 -3
View File
@@ -1310,7 +1310,7 @@ int get_ptp_anchor_local_time_info(rtsp_conn_info *conn, uint32_t *anchorRTP,
// if the master clock and the anchor clock are the same
// wait at least this time before using the new master clock
// note that mastershipo may be backdated
if (duration_of_mastership < 100000000) {
if (duration_of_mastership < 275000000) {
debug(3, "master not old enough yet: %f ms", 0.000001 * duration_of_mastership);
response = clock_not_ready;
} else if ((duration_of_mastership > 5000000000) ||
@@ -2254,7 +2254,7 @@ void *rtp_buffered_audio_processor(void *arg) {
int streaming_has_started = 0;
int play_enabled = 0;
uint32_t flush_from_timestamp;
double requested_lead_time = 0.0; // normal lead time minimum -- maybe it should be about 0.1
double requested_lead_time = 0.1; // normal lead time minimum -- maybe it should be about 0.1
// wait until our timing information is valid
@@ -2642,7 +2642,7 @@ void *rtp_buffered_audio_processor(void *arg) {
if (pkt->size) {
// if (0) {
if (pkt->size <= 7) { // no idea about this...
debug(1, "malformed AAC packet skipped.");
debug(2, "malformed AAC packet skipped.");
} else {
ret = avcodec_send_packet(codec_context, pkt);
+5 -5
View File
@@ -697,7 +697,7 @@ void cancel_all_RTSP_threads(airplay_stream_c stream_category, int except_this_o
((stream_category == unspecified_stream_category) ||
(stream_category == conns[i]->airplay_stream_category))) {
pthread_cancel(conns[i]->thread);
debug(1, "Connection %d: cancelled.", conns[i]->connection_number);
debug(2, "Connection %d: cancelled.", conns[i]->connection_number);
}
}
for (i = 0; i < nconns; i++) {
@@ -706,7 +706,7 @@ void cancel_all_RTSP_threads(airplay_stream_c stream_category, int except_this_o
((stream_category == unspecified_stream_category) ||
(stream_category == conns[i]->airplay_stream_category))) {
pthread_join(conns[i]->thread, NULL);
debug(1, "Connection %d: joined.", conns[i]->connection_number);
debug(2, "Connection %d: joined.", conns[i]->connection_number);
free(conns[i]);
conns[i] = NULL;
}
@@ -2625,7 +2625,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
uint8_t isRemoteControlOnlyBoolean = 0;
plist_get_bool_val(isRemoteControlOnly, &isRemoteControlOnlyBoolean);
if (isRemoteControlOnlyBoolean != 0) {
debug(1, "Connection %d: SETUP: Remote Control setup detected.",
debug(2, "Connection %d: SETUP: Remote Control setup detected.",
conn->connection_number);
conn->airplay_stream_category = remote_control_stream;
} else {
@@ -2825,7 +2825,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
conn->connection_number, err);
}
debug(1, "Connection %d: TCP Remote Control event port opened: %u.",
debug(2, "Connection %d: TCP Remote Control event port opened: %u.",
conn->connection_number, conn->local_event_port);
if (conn->rtp_event_thread != NULL)
debug(1, "previous rtp_event_thread allocation not freed, it seems.");
@@ -3056,7 +3056,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
resp->respcode = 200;
} else if (conn->airplay_stream_category == remote_control_stream) {
debug(2, "Connection %d: SETUP: Remote Control Stream received.", conn->connection_number);
debug_log_rtsp_message(1, "Remote Control Stream stream (second) message", req);
debug_log_rtsp_message(2, "Remote Control Stream stream (second) message", req);
resp->respcode = 200;
} else {