music-assistant-server

Branch:dev-lidarr-plugin

Commit Details

AirPlay: fall back to the default port when discovery has no port (#6185)

# What does this implement/fix?

AirPlay 2 playback fails on some receivers with `cliairplay did not
connect to <player>` after a 10 second wait, while AirPlay 1 (RAOP)
works on the same device. The binary is started against port 0:

```
[AP2] Created client for Bagno (192.168.178.55:0) [RAOP-compat]
Connecting to 192.168.178.55:0 via AirPlay 2
[AP2] Connecting via native AP2 flow to 192.168.178.55:0
```

`_build_cli_args()` passed the discovered service port straight to
`--port`. Discovery can hand back a port of `None` or `0` when the SRV
record never arrived: `AsyncServiceInfo.port` defaults to `None`, and
zeroconf considers an info complete once it has an address record, so
`async_request()` can return successfully with no SRV. The binary parses
`--port` with `atoi()`, so both values become port 0 and it dials TCP/0.

Every other port read in the provider already guarded this, so this
applies the same fallback in the one place that missed it, and gives the
two well-known ports names instead of repeating the literals at four
call sites.

**Related issue (if applicable):**

- related issue https://github.com/music-assistant/support/issues/6296

## Types of changes

- [x] Bugfix (non-breaking change which fixes an issue) — `bugfix`
- [ ] New feature (non-breaking change which adds functionality) —
`new-feature`
- [ ] Enhancement to an existing feature — `enhancement`
- [ ] New music/player/metadata/plugin provider — `new-provider`
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected) — `breaking-change`
- [ ] Refactor (no behaviour change) — `refactor`
- [ ] Documentation only — `documentation`
- [ ] Maintenance / chore — `maintenance`
- [ ] CI / workflow change — `ci`
- [ ] Dependencies bump — `dependencies`

## Checklist

- [x] The code change is tested and works locally.
- [x] `pre-commit run --all-files` passes.
- [x] `pytest` passes, and tests have been added/updated under `tests/`
where applicable.
- [ ] (N/A) For changes to shared models, the companion PR in
`music-assistant/models` is linked.
- [ ] (N/A) For changes affecting the UI, the companion PR in
`music-assistant/frontend` is linked.
- [x] I have read and complied with the project's [AI
Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md)
for any AI-assisted contributions.
- [ ] (N/A) I have [raised a PR against the documentation
repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md)
targeting the main or beta branch as appropriate.
Forgejo

Author

Marvin Schenkel<[email protected]>
September 3, 2026 at 10:27 AM UTC

Committer

Marvin Schenkel<[email protected]>
September 4, 2026 at 07:55 AM UTC
24additions
1deletions
5files changed

Parent commits

Changes

5 files
+24-1

Changed Files (5)

music_assistant/providers/airplay/
tests/providers/airplay/
music_assistant/providers/airplay/constants.py
music_assistant/providers/airplay/pairing.py
+1-1
music_assistant/providers/airplay/player.py
+2
music_assistant/providers/airplay/stream.py
+2
tests/providers/airplay/test_stream.py
+19