Make cancel_all_RTSP_threads be specific about what kind of listeners it will kill, if needed. Quieten a few more messages.

This commit is contained in:
Mike Brady
2025-12-05 13:29:35 +00:00
parent a755a26e92
commit 21e7d628ef
2 changed files with 14 additions and 12 deletions
+3 -3
View File
@@ -517,7 +517,7 @@ void *rtp_buffered_audio_processor(void *arg) {
} else {
timestamp_difference = timestamp - expected_timestamp;
if (timestamp_difference != 0) {
debug(1,
debug(2,
"Connection %d: "
"unexpected timestamp in block %u. Actual: %u, expected: %u "
"difference: %d, "
@@ -542,8 +542,8 @@ void *rtp_buffered_audio_processor(void *arg) {
int32_t abs_timestamp_difference = -timestamp_difference;
if ((size_t)abs_timestamp_difference > get_ssrc_block_length(payload_ssrc)) {
skip_this_block = 1;
debug(1,
"skipping block %u because it was too far in the past. Timestamp "
debug(2,
"skipping block %u because it is too old. Timestamp "
"difference: %d, length of block: %u.",
seq_no, timestamp_difference, get_ssrc_block_length(payload_ssrc));
}
+11 -9
View File
@@ -487,22 +487,28 @@ static void track_thread(rtsp_conn_info *conn) {
}
// note: connection numbers start at 1, so an except_this_one value of zero means "all threads"
void cancel_all_RTSP_threads(__attribute((unused)) airplay_stream_c stream_category, int except_this_one) {
void cancel_all_RTSP_threads(airplay_stream_c stream_category, int except_this_one) {
// if the stream category is unspecified_stream_category
// all categories are elegible for cancellation
// otherwise just the category itself
debug_mutex_lock(&conns_lock, 1000000, 3);
int i;
for (i = 0; i < nconns; i++) {
if ((conns[i] != NULL) && (conns[i]->running != 0) &&
(conns[i]->connection_number != except_this_one)) {
if (
(conns[i] != NULL) && (conns[i]->running != 0) &&
(conns[i]->connection_number != except_this_one) &&
((conns[i]->airplay_stream_category == stream_category) || (stream_category == unspecified_stream_category))
) {
pthread_cancel(conns[i]->thread);
debug(1, "Connection %d: %s cancelled.", conns[i]->connection_number, get_category_string(conns[i]->airplay_stream_category));
}
}
for (i = 0; i < nconns; i++) {
if ((conns[i] != NULL) &&
(conns[i]->connection_number != except_this_one)) {
if (
(conns[i] != NULL) &&
(conns[i]->connection_number != except_this_one) &&
((conns[i]->airplay_stream_category == stream_category) || (stream_category == unspecified_stream_category))
) {
debug(1, "Connection %d: %s joining....", conns[i]->connection_number, get_category_string(conns[i]->airplay_stream_category));
pthread_join(conns[i]->thread, NULL);
debug(1, "Connection %d: %s joined.", conns[i]->connection_number, get_category_string(conns[i]->airplay_stream_category));
@@ -1827,11 +1833,7 @@ void handle_setrateanchori(rtsp_conn_info *conn, rtsp_message *req, rtsp_message
debug(2, "Connection %d: SETRATEANCHORI Pause playing.", conn->connection_number);
conn->ap2_play_enabled = 0;
activity_monitor_signify_activity(0);
#ifdef CONFIG_CONVOLUTION
// convolver_clear_state();
#endif
// reset_anchor_info(conn);
#ifdef CONFIG_METADATA
send_ssnc_metadata('paus', NULL, 0, 1); // pause -- contains cancellation points
#endif