mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.3k stars 574 forks source link

no client metadata when using AirPlay 2 #1354

Closed ccutrer closed 2 years ago

ccutrer commented 2 years ago

I'm connecting an iPhone 13 on iOS 15 and an AppleTV on tvOS 15, but I'm not seeing any of the metadata items to identify the client coming through. I'm looking for any of clip, snua, or snam. I'm assuming it's cause these items come from rtp.c and rtsp.c, and AirPlay 2 goes through a different route?

mikebrady commented 2 years ago

Thanks for the post. Can you give us some more information, please?

Update: you could be right, but it would be good just to get a little more info. Thanks.

ccutrer commented 2 years ago

Version:

4.1-dev-25-ga05db621-AirPlay2-OpenSSL-Avahi-ALSA-soxr-metadata-mqtt-sysconfdir:/etc

Relevant config:

// How to deal with metadata, including artwork
metadata =
{
        enabled = "yes"; // set this to yes to get Shairport Sync to solicit metadata from the source and to pass it on via a pipe
//      include_cover_art = "no"; // set to "yes" to get Shairport Sync to solicit cover art from the source and pass it via the pipe. You must also set "enabled" to "yes".
        pipe_name = "/tmp/shairport-sync-metadata";
        pipe_timeout = 5000; // wait for this number of milliseconds for a blocked pipe to unblock before giving up
//      socket_address = "226.0.0.1"; // if set to a host name or IP address, UDP packets containing metadata will be sent to this address. May be a multicast address. "socket-port" must be non-zero and "enabled" must be set to yes"
//      socket_port = 5555; // if socket_address is set, the port to send UDP packets to
//      socket_msglength = 65000; // the maximum packet size for any UDP metadata. This will be clipped to be between 500 or 65000. The default is 500.
};

mqtt =
{
        enabled = "yes"; // set this to yes to enable the mqtt-metadata-service
        hostname = "mqtt.cutrer.network"; // Hostname of the MQTT Broker
        port = 1883; // Port on the MQTT Broker to connect to
        username = "shairport-sync"; //set this to a string to your username in order to enable username authentication
        password = "<redacted>"; //set this to a string you your password in order to enable username & password authentication
        topic = "shairport-sync"; //MQTT topic where this instance of shairport-sync should publish. If not set, the general.name value is used.
        publish_raw = "yes"; //whether to publish all available metadata under the codes given in the 'metadata' docs.
        publish_parsed = "yes"; //whether to publish a small (but useful) subset of metadata under human-understandable topics
        publish_cover = "no"; //whether to publish the cover over mqtt in binary form. This may lead to a bit of load on the broker
        enable_remote = "yes"; //whether to remote control via MQTT. RC is available under `topic`/remote.
};

snapshot of what metadata came through in MQTT (from MQTT explorer) from a tvOS session: https://www.dropbox.com/s/23akkafl9wcpv7q/Screen%20Shot%202021-12-01%20at%208.00.47%20AM.png?dl=0

log file from starting shairport-sync, connecting iPhone, playing song, pausing, killing shairport-sync: https://www.dropbox.com/s/2ihti1b83tnutoc/shairport-sync-codyiphone.log?dl=0

mikebrady commented 2 years ago

Excellent stuff, thanks!

mikebrady commented 2 years ago

Hi there. I've added a few missing metadata items in the latest build -- svip and 'clip -- server and client IPs respectively. I'll have a look at adding clip, snua, and snam. Are there more missing?

ccutrer commented 2 years ago

I just built 598ddc319c1141674f223da8e377134ad51d40bf, and I'm getting clip and svip now (as well as daid, which I have a feeling is going to be more stable for my automations to know if a particular device is playing). But active_start and active_end no longer seem to be coming through, nor are play_start, play_end, play_flush, or play_resume.

ccutrer commented 2 years ago

hmm, enabling -vv logging, it looks like it is trying to publish them. perhaps my MQTT Explorer is not showing them because of the empty payload. I'll dig some more.

ccutrer commented 2 years ago

yup, that's definitely the case. those messages are coming through just fine when I use mosquito_sub -v. so really the only ones that I'd like to see are snua and snam.

ccutrer commented 2 years ago

bah, neither Active Remote ID nor DACP ID are stable over multiple sessions from a single device. and the IP I'm getting is also changing cause it's using IPv6 private addressing...

ccutrer commented 2 years ago

1389 should fully resolve this issue (I didn't see an equivalent of User Agent for AP2, but I did find several other fields that are both more specific and relevant and useful)

mikebrady commented 2 years ago

Thanks. I had to add a couple of conditional compilation statements to your PR but otherwise it's a nice addition!