From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Fri, 5 Dec 2025 13:29:35 +0000 (+0000) Subject: Make cancel_all_RTSP_threads be specific about what kind of listeners it will kill... X-Git-Tag: 5.0-post-dev~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21e7d628ef7eb3a44a75e998a37c7474fd6d0f51;p=thirdparty%2Fshairport-sync.git Make cancel_all_RTSP_threads be specific about what kind of listeners it will kill, if needed. Quieten a few more messages. --- diff --git a/ap2_buffered_audio_processor.c b/ap2_buffered_audio_processor.c index d11b0742..b359e0e8 100644 --- a/ap2_buffered_audio_processor.c +++ b/ap2_buffered_audio_processor.c @@ -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)); } diff --git a/rtsp.c b/rtsp.c index cc5dd088..212e3d54 100644 --- a/rtsp.c +++ b/rtsp.c @@ -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