Repository navigation
fix(dlna): answer browsemetadata on containers and advertise a reachable address - #907
Merged
Merged
Conversation
A BrowseMetadata on 0/artists, 0/albums or one artist or album answered an empty DIDL, so a controller that reads a folder's metadata before opening or queueing it showed the folder empty. Containers carried no childCount, and a track's own metadata named the root as its parent. Object ids are now parsed once into an ObjectId that both browse flags dispatch on. Every container id answers BrowseMetadata with a single container carrying its childCount, from index-backed COUNT subqueries that the listings now carry too. An album names 0/albums as its parent (the container its id lives under) and a track names its album.
The servers took the first non-loopback IPv4 the OS listed, joined the SSDP group on that interface only and put it in every LOCATION, URLBase, stream and cover URL. With a VPN, WSL, Hyper-V or Docker adapter listed first, a receiver was pointed at an address it cannot reach. lan_addrs now ranks every IPv4 address: a private one on a running, physical interface first, then a non-private one, then point-to-point, down or VPN / VM / container-named adapters, link-local last. The name match only demotes. SSDP joins the group on every interface, sends each NOTIFY batch out of each interface with its own address, and answers an M-SEARCH with the address on the requester's subnet. The HTTP layer builds its URLs from the local address each request arrived on, read through ConnectInfo. With no IPv4 address at all, SSDP now reports an error instead of announcing 0.0.0.0. MPD only displays the address (clients connect to us), so it keeps calling pick_lan_ip and simply shows the better-ranked one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two defects in the opt-in DLNA server: folders answered nothing when a controller asked for their metadata, and the server could advertise an address the receiver cannot reach.
BrowseMetadata on a container returned nothing
browse_metadataonly handled the root and0/track/<id>. A BrowseMetadata on0/artists,0/albums,0/albums/<id>or0/artists/<id>answered an empty DIDL. No container carriedchildCount, and a track reportedparentID="0". Controllers that read a folder's metadata before listing it, or before queueing a whole folder, stalled or showed it empty.ObjectIdenum parses ids once for both browse flags.<container>carrying its id,parentID, title, class andchildCount. The counts come from index-backed COUNT subqueries (idx_album_artist,idx_track_album_available) and only include available tracks. Listings carrychildCounttoo.0/albums, its canonical place, even when it was reached through an artist. A track names its album container, or0when it has no album.The servers advertised the first IPv4 they found
pick_lan_iptook.next(), SSDP joined only that interface, and MPD showed the same address. With a VPN, Hyper-V, WSL or Docker adapter listed first, the description, stream and cover URLs pointed at an address the receiver could not reach.lan_addrs()puts private addresses on running interfaces first, then public ones, then point-to-point, down or adapters named like a VPN/VM/container, then link-local. A name only lowers an address's rank, it never drops it.URLBaseare built from the address each request arrived on (ConnectInfo). Without this, a correct LOCATION would still have led to unreachable stream URLs.Checks
childCount, interface ranking, subnet matching (including IPv4-mapped peers) and the LOCATION format.cds.rswere run against an in-memory database built from every profile migration.cargo fmt --checkpasses,cargo clippy -p waveflow --all-targets -D warningsis clean, and the app tests compile (they run on the CI's Ubuntu job).docs/features/dlna.mdanddocs/features/mpd.md.To test: on a PC with WSL, Hyper-V or a VPN, enable the server. In BubbleUPnP or VLC, open Artists, then an artist, then an album. The folders should show counts, "play all" should queue the album, and the stream URLs should use the LAN IP.
@coderabbitai review
Summary by CodeRabbit