music-assistant-server
Branch:dev-lidarr-plugin
Commit Details
Fix raw PCM input being decoded with the source codec (#6137)
# What does this implement/fix? <!-- Quick description and explanation of changes. --> `get_ffmpeg_args` declared the PCM decoder for a raw input container, then unconditionally appended a second `-acodec` for `input_format.codec_type`. ffmpeg applies the last `-acodec` it is given, so whenever a caller passed a PCM `content_type` alongside a populated `codec_type` the source codec's decoder was pointed at raw samples. Background audio analysis hits this on every track: it builds its PCM format with `dataclasses.replace()` on the track's AudioFormat, which swaps `content_type` but carries `codec_type` over from the encoded source. The loudness provider's ebur128 process was therefore started as "-f s16le -acodec pcm_s16le -acodec flac -i -", failing every packet with "Invalid data found when processing input" until the 50-error guard aborted the stream. The source files were never at fault. Make the `codec_type` branch an `elif` so it only applies to encoded input, where the container does not already imply the decoder. Reproduced with a FLAC supplied in the bug report. The file decodes cleanly; the failure was reproduced by replaying its decoded PCM through the arg order the pre-fix code generates. **Related issue (if applicable):** - related issue https://github.com/music-assistant/support/issues/6267 ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) derives the label from the ticked box and applies it automatically; the release-notes generator uses that same label to slot this change into the next release notes. --> - [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. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [ ] 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. - [ ] 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. Co-authored-by: Claude <[email protected]>
Author
OzGav<[email protected]>
September 1, 2026 at 01:29 AM UTC
Committer
Marvin Schenkel<[email protected]>
September 4, 2026 at 07:55 AM UTC
40additions
0deletions
2files changed
Parent commits
Changes
2 files
+40-0
Changed Files (2)
music_assistant/helpers/
tests/helpers/
music_assistant/helpers/ffmpeg.py
tests/helpers/test_ffmpeg.py
+40