From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Sat, 25 Jun 2022 09:47:18 +0000 (+0100) Subject: Set the initial volume to 0.0 (full volume) if ignore_volume_control is selected... X-Git-Tag: 4.1-rc1~24^2~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f551274a2ecee586b3bae8eb6124da0b79498cce;p=thirdparty%2Fshairport-sync.git Set the initial volume to 0.0 (full volume) if ignore_volume_control is selected. Add some code to explore remote_control. Still not even close to working. --- diff --git a/player.c b/player.c index 364a8b7e..96e2c1eb 100644 --- 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 c729f286..7d50aa5c 100644 --- 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 fa5c20ee..0d8c11d4 100644 --- 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); }