aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Controller.Tests/MediaEncoding/EncodingHelperTests.cs
AgeCommit message (Collapse)Author
13 daysFix PCM audio transcoding to wav returning HTTP 500 and headerless outputvdatanet
`GetProgressiveAudioFullCommandLine` forced the raw PCM muxer and a bogus sample rate whenever the audio encoder was `pcm_*`, regardless of the container the client asked for. Two separate failures came out of it: - `-ar ` + `state.BaseRequest.AudioBitRate` used a *bitrate* as a *sample rate*, and `AudioBitRate` is optional. When it is absent the argument degrades to a bare `-ar`, ffmpeg aborts with `Expected number for ar but found: -ar` / `Error opening output files: Invalid argument` (exit 234) and the request fails with HTTP 500. Every `GET /Audio/{id}/stream.wav` that does not carry an explicit `AudioBitRate` hits this. The sample rate was already being set correctly a few lines below from `OutputAudioSampleRate`, so the line is dropped rather than repaired. - `-f s16le` overrode the muxer even for a real container. A request that did supply a bitrate (`/Audio/{id}/universal` passes `MaxStreamingBitrate`) survived the first bug but produced raw headerless samples served under an `audio/wav` content type, so clients saw a body with no RIFF header. The raw muxer is now only forced when the requested container is actually raw PCM, which keeps the I2S/MCU route from #10321 working. Also drop the `containerInternal = ".pcm"` assignment in `StreamingHelpers.GetStreamingState`: it is written after `state.OutputContainer` has already been read from the same variable and is never read again, so it has no effect and only obscures where the output container comes from. Verified against ffmpeg 8.1.2 with a 96 kHz FLAC source: before, the wav command line exits 234; after, it produces a valid `RIFF/WAVE` 48 kHz stereo `pcm_s16le` file, while the raw `.pcm` route still yields exactly 2 s x 48000 x 2ch x 2 B = 384000 bytes of headerless samples.
2026-06-21Fix audio sample rate forced to 48 kHz for non-Opus codecsdanne
GetProgressiveAudioFullCommandLine applied the libopus-only sample rate quantization to every codec except Opus, inverting the intended guard. A requested rate such as 44100 Hz was therefore snapped to 48000 Hz for AAC/MP3/FLAC, while Opus (which actually requires the quantization) was skipped entirely. Apply the quantization only when the output codec is Opus, and pass the requested sample rate through unchanged for all other codecs. Fixes #17026 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-19Use file-scoped namespace in EncodingHelperTestsPiotr Niełacny
2026-05-19Normalize VobSub .sub to .idx for embedding, add EncodingHelper testsPiotr Niełacny
Move the .sub to .idx path normalization outside the burn-in check so it applies to subtitle embedding as well. ffmpeg requires the .idx file to read VobSub subtitles. Add unit tests for GetMapArgs and GetInputArgument covering internal subs, external SRT, multi-file SRT, multi-stream MKS containers, and VobSub .sub/.idx path normalization.
2026-05-19Fix external subtitle stream mapping for multi-stream containersPiotr Niełacny
Compute the in-file stream index for external subtitles instead of hardcoding -map 1:0. For single-stream files (SRT/ASS/VTT) the index is always 0, preserving existing behavior. For multi-stream containers like MKS, the correct track is selected by counting sibling streams that share the same Path. Add unit tests for GetMapArgs covering internal subs, external SRT, multiple external files, and multi-stream MKS containers.