Fix DLNA players reporting a position that runs ahead of the audio - #5477
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes DLNA playback position anchoring so reported elapsed time no longer runs ahead of actual audio after start/resume events, preventing incorrect queue behavior (including universal group propagation).
Changes:
- Serialize “start/resume/pause” event handling by polling device state before reading/reporting position.
- Clamp the position timestamp anchor so it never predates the moment playback resumed.
- Add regression tests covering both the resume-timestamp case and the event-ordering case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| music_assistant/providers/dlna/player.py | Tracks observed PLAYING transitions to clamp position anchoring; ensures AVTransport TransportState events poll before state/position reporting. |
| tests/providers/dlna/test_device_state.py | Adds tests for resume anchoring and for polling-before-read on TransportState events. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The device only re-stamps a position that actually changed and the position is never evented, so the position known at the moment a transport state change arrives can date from well before it. Poll before reporting the new state, and never anchor a position earlier than the start of playback.
marcelveldt
force-pushed
the
dlna-fresh-position-anchor
branch
from
August 7, 2026 23:12
9b1062c to
a2c0d08
Compare
marcelveldt
marked this pull request as ready for review
August 7, 2026 23:15
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.
What does this implement/fix?
A DLNA player could report a playback position that ran ahead of the audio, which since #5461 also propagates to any universal group it plays in.
A DLNA device never sends its position as an event, and the underlying library only re-stamps a position that actually changed. Two things went wrong with that:
Resuming after a longer pause could therefore report a position far past the real one, which can make the queue skip the rest of the track.
Related issue (if applicable):
Changes
Types of changes
bugfixnew-featureenhancementnew-providerbreaking-changerefactordocumentationmaintenancecidependenciesChecklist
pre-commit run --all-filespasses.pytestpasses, and tests have been added/updated undertests/where applicable.music-assistant/modelsis linked.music-assistant/frontendis linked.