]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Set the initial volume to 0.0 (full volume) if ignore_volume_control is selected...
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Sat, 25 Jun 2022 09:47:18 +0000 (10:47 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Sat, 25 Jun 2022 09:47:18 +0000 (10:47 +0100)
player.c
rtp.c
rtsp.c

index 364a8b7ecec52af74904fd65b6d9f52036f37db7..96e2c1ebbccafd52f9a95d5884837917424954bb 100644 (file)
--- a/player.c
+++ b/player.c
@@ -2096,6 +2096,8 @@ void *player_thread_func(void *arg) {
   pthread_setcancelstate(oldState, NULL);
 
   double initial_volume = config.airplay_volume; // default
+  if (config.ignore_volume_control != 0)
+    initial_volume = 0.0; // set the default to full volume if ignore volume control is on
   if (conn->initial_airplay_volume_set)          // if we have been given an initial volume
     initial_volume = conn->initial_airplay_volume;
   // set the default volume to whatever it was before, as stored in the config airplay_volume
diff --git a/rtp.c b/rtp.c
index c729f286a5a1a1b908eaed5204c4738cb43f11ff..7d50aa5c106423aa3ac65752824eb91708d461ab 100644 (file)
--- a/rtp.c
+++ b/rtp.c
@@ -1510,7 +1510,11 @@ void rtp_data_receiver_cleanup_handler(void *arg) {
 
 void *rtp_data_receiver(void *arg) {
   rtsp_conn_info *conn = (rtsp_conn_info *)arg;
-  debug(1, "Connection %d: AP2 Data Receiver started", conn->connection_number);
+  if (conn->airplay_stream_category == remote_control_stream)
+    debug(1, "Connection %d (RC): AP2 Data Receiver started", conn->connection_number);
+  else
+    debug(1, "Connection %d: AP2 Data Receiver started", conn->connection_number);
+    
   pthread_cleanup_push(rtp_data_receiver_cleanup_handler, arg);
 
   listen(conn->data_socket, 5);
@@ -1563,7 +1567,10 @@ void rtp_event_receiver_cleanup_handler(void *arg) {
 
 void *rtp_event_receiver(void *arg) {
   rtsp_conn_info *conn = (rtsp_conn_info *)arg;
-  debug(1, "Connection %d: AP2 Event Receiver started", conn->connection_number);
+  if (conn->airplay_stream_category == remote_control_stream)
+    debug(1, "Connection %d (RC): AP2 Event Receiver started", conn->connection_number);
+  else
+    debug(1, "Connection %d: AP2 Event Receiver started", conn->connection_number);
   pthread_cleanup_push(rtp_event_receiver_cleanup_handler, arg);
 
   listen(conn->event_socket, 5);
diff --git a/rtsp.c b/rtsp.c
index fa5c20ee658446c3dd8b7045bf74bd695482ca27..0d8c11d4d6a185b7c6d5b26fdfe050919604c71e 100644 (file)
--- a/rtsp.c
+++ b/rtsp.c
@@ -2507,8 +2507,23 @@ void teardown_phase_two(rtsp_conn_info *conn) {
   // we are being asked to disconnect
   // this can be called more than once on the same connection --
   // by the player itself but also by the play seesion being killed
-  debug(2, "Connection %d: TEARDOWN a %s connection.", conn->connection_number,
-        get_category_string(conn->airplay_stream_category));
+    debug(2, "Connection %d: TEARDOWN a %s connection.", conn->connection_number,
+          get_category_string(conn->airplay_stream_category));
+  if (conn->airplay_stream_category == remote_control_stream) {
+    if (conn->rtp_data_thread) {
+      debug(2, "Connection %d (RC): TEARDOWN Delete Data Thread.", conn->connection_number);
+      pthread_cancel(*conn->rtp_data_thread);
+      pthread_join(*conn->rtp_data_thread, NULL);
+      free(conn->rtp_data_thread);
+      conn->rtp_data_thread = NULL;
+    }
+    debug(2, "Connection %d: TEARDOWN Close Data Socket.", conn->connection_number);
+    if (conn->data_socket) {
+      close(conn->data_socket);
+      conn->data_socket = 0;
+    }
+  }
+
   if (conn->rtp_event_thread) {
     debug(2, "Connection %d: TEARDOWN Delete Event Thread.", conn->connection_number);
     pthread_cancel(*conn->rtp_event_thread);
@@ -2520,8 +2535,6 @@ void teardown_phase_two(rtsp_conn_info *conn) {
   if (conn->event_socket) {
     close(conn->event_socket);
     conn->event_socket = 0;
-    debug(2, "Connection %d: closing TCP event port %u.", conn->connection_number,
-          conn->local_event_port);
   }
 
   // if we are closing a PTP stream only, do this
@@ -3154,7 +3167,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
       plist_dict_set_item(setupResponsePlist, "streams", streams_array);
       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(2, "Connection %d (RC): SETUP: Remote Control Stream received.", conn->connection_number);
 
       // get a port to use as an data port
       // bind a new TCP port and get a socket
@@ -3163,7 +3176,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
           bind_socket_and_port(SOCK_STREAM, conn->connection_ip_family, conn->self_ip_string,
                                conn->self_scope_id, &conn->local_data_port, &conn->data_socket);
       if (err) {
-        die("SETUP on Connection %d: Error %d: could not find a TCP port to use as a data "
+        die("SETUP on Connection %d (RC): Error %d: could not find a TCP port to use as a data "
             "port",
             conn->connection_number, err);
       }