]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Make cancel_all_RTSP_threads be specific about what kind of listeners it will kill...
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Fri, 5 Dec 2025 13:29:35 +0000 (13:29 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Fri, 5 Dec 2025 13:29:35 +0000 (13:29 +0000)
ap2_buffered_audio_processor.c
rtsp.c

index d11b074213a27845bec969dc92880b74e516f83b..b359e0e85ecc9a3b84c3e0cb24e80463f4b8d2fa 100644 (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));
                     }
diff --git a/rtsp.c b/rtsp.c
index cc5dd088e1f4f8a84381bb9eba018b6582f3c6f4..212e3d5479dea8fc5d15adbf884b3006cabb994d 100644 (file)
--- 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