diff --git a/MQTT.md b/MQTT.md index fbb90a80..c5be761c 100644 --- a/MQTT.md +++ b/MQTT.md @@ -191,34 +191,29 @@ binary_sensor: Below parsed data is saved into the Home Assistant database as sensor data. Please note the conversion of the volume from dB to percentage. ```yml -sensor: - - platform: mqtt - name: "shairport album" - state_topic: "shairport/album" - expire_after: 600 - - - platform: mqtt - name: "shairport artist" - state_topic: "shairport/artist" - expire_after: 600 - - - platform: mqtt - name: "shairport title" - state_topic: "shairport/title" - expire_after: 600 - - - platform: mqtt - name: "shairport genre" - state_topic: "shairport/genre" - expire_after: 600 - - - platform: mqtt - name: "shairport volume (dB)" - state_topic: "shairport/volume" - - - platform: mqtt - name: "shairport volume (PCT)" - state_topic: "shairport/volume" - value_template: "{{ value | regex_findall_index(find='^(.+?),', index=0, ignorecase=False) | float / 30 + 1 }}" - unit_of_measurement: 'percent' +mqtt: + sensor: + - name: "shairport album" + state_topic: "shairport/album" + expire_after: 600 + + - name: "shairport artist" + state_topic: "shairport/artist" + expire_after: 600 + + - name: "shairport title" + state_topic: "shairport/title" + expire_after: 600 + + - name: "shairport genre" + state_topic: "shairport/genre" + expire_after: 600 + + - name: "shairport volume (dB)" + state_topic: "shairport/volume" + + - name: "shairport volume (PCT)" + state_topic: "shairport/volume" + value_template: "{{ value | regex_findall_index(find='^(.+?),', index=0, ignorecase=False) | float / 30 + 1 }}" + unit_of_measurement: 'percent' ``` diff --git a/RELEASENOTES-DEVELOPMENT.md b/RELEASENOTES-DEVELOPMENT.md index 0a6b4ea7..3a117700 100644 --- a/RELEASENOTES-DEVELOPMENT.md +++ b/RELEASENOTES-DEVELOPMENT.md @@ -1,3 +1,8 @@ +Version 4.1-dev-876-g29ca3225 +==== +**Bug Fix** +* Fix a bug reported in Issue [#1633](https://github.com/mikebrady/shairport-sync/issues/1633). The bug was that when a Realtime Audio stream (e.g. playing from Spotify on iOS or using Shairport Sync as the Sound Output on a Mac) was played, it was fine, but when a second stream was started, it could not be heard. The problem was that the PTP clock was not being correctly revalidated for second and subsequent Realtime Audio streams. The fix was to ensure that the PTP clock is revalidated on second and subsequent plays on the same connection. Thanks again to [David Leibovic](https://github.com/dasl-) for finding the problem. + Version 4.1-dev-874-g551734b3 ==== **Bug Fix** diff --git a/rtsp.c b/rtsp.c index ed67c581..f53bd351 100644 --- a/rtsp.c +++ b/rtsp.c @@ -2028,7 +2028,7 @@ void handle_setrateanchori(rtsp_conn_info *conn, rtsp_message *req, rtsp_message pthread_cleanup_push(mutex_unlock, &conn->flush_mutex); conn->ap2_rate = rate; if ((rate & 1) != 0) { - ptp_send_control_message_string("B"); // signify play is "B"eginning or resuming + ptp_send_control_message_string("B"); // signify clock dependability period is "B"eginning (or resuming) debug(2, "Connection %d: Start playing, with anchor clock %" PRIx64 ".", conn->connection_number, conn->networkTimeTimelineID); activity_monitor_signify_activity(1); @@ -2963,7 +2963,6 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) // if it's a full service PTP stream, we get groupUUID, groupContainsGroupLeader and // timingPeerList if (conn->airplay_stream_category == ptp_stream) { - ptp_send_control_message_string("B"); // signify play is "B"eginning if (ptp_shm_interface_open() != 0) // it should be open already, but just in case it isn't... die("Can not access the NQPTP service. Has it stopped running?"); @@ -3079,6 +3078,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) // debug(1,"initial timing peer command: \"%s\".", timing_list_message); // ptp_send_control_message_string(timing_list_message); set_client_as_ptp_clock(conn); + ptp_send_control_message_string("B"); // signify clock dependability period is "B"eginning (or continuing) plist_dict_set_item(timingPeerInfoPlist, "Addresses", addresses); plist_dict_set_item(timingPeerInfoPlist, "ID", plist_new_string(conn->self_ip_string)); plist_dict_set_item(setupResponsePlist, "timingPeerInfo", timingPeerInfoPlist); @@ -3193,6 +3193,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) conn->connection_number, get_category_string(conn->airplay_stream_category)); if (conn->airplay_stream_category == ptp_stream) { // get stream[0] + ptp_send_control_message_string("B"); // signify clock dependability period is "B"eginning (or continuing) plist_t stream0 = plist_array_get_item(streams, 0); plist_t streams_array = plist_new_array(); // to hold the ports and stuff