You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make the dca_core core-strip opt-in (or per-packet-fallback), not unconditional — it discards lossless DTS-HD MA (XLL) for streams that decode fine #66
4.0.1 routes every DTS source through the dca_core bitstream filter, stripping each packet to its lossy core before the decoder. For DTS-HD MA streams that decode the full XLL without error, this is a lossless→lossy regression vs the pre-3.13.4 full path — audible for hosts that bridge to FLAC (.lossless) for multichannel LPCM to an AVR.
The full decoder path genuinely decodes XLL losslessly — provable from the very error being worked around (Residual encoded channels are present without core is an XLL-decode failure, so the decoder is attempting lossless decode and only chokes on specific frames). For a stream whose frames all decode, the pre-3.13.4 path produced true lossless; 4.0.1 discards it wholesale.
You already added a per-packet EINVAL (-22) skip in feed(), which handles the #64 "residual channels without core" frames without sacrificing lossless on every other frame. But the dca_core filter is applied unconditionally whenever the FFmpeg build ships it (the per-packet skip is only the fallback when the filter is absent), and there's no LoadOptions flag to opt out — audioBridgeMode only selects FLAC vs EAC3 for the encode, not the DTS decode.
Could the core-strip be either:
opt-in via a LoadOptions flag (default off → full decode + the per-packet skip you already wrote), or
applied only as a per-packet fallback when a frame actually fails to decode?
Either keeps #64's robustness for the broken-stream case while preserving lossless for streams that decode fine. Concretely, this currently blocks us from adopting the 4.x line for the terminal PlaybackState.ended state (#63) without downgrading our users' DTS-HD MA — we're holding at 3.13.3 specifically to keep lossless.
Environment: AetherEngine 4.0.1, tvOS 26, FLAC bridge mode (audioBridgeMode: .lossless), DTS-HD MA Blu-ray remuxes that decode the full XLL cleanly.
Thanks for the precise report and the analysis, you were right on the core point.
4.0.1 (and 3.13.5) ran every DTS source through the dca_core bitstream filter, which strips each packet to its lossy DTS core before the decoder. For a DTS-HD MA stream that decodes the full XLL cleanly, that threw the lossless extension away and the FLAC bridge re-encoded the lossy core, exactly the regression you described.
Two things made the bitstream filter the wrong lever in hindsight:
The full decode path was already correct. avformat_find_stream_info decodes a probe frame at open and writes the real sample_fmt (S32P for DTS-HD MA) back into the codec parameters, so the bridge's resampler was seeded correctly and the pre-3.13.4 full-decode path was genuinely lossless. That is why holding at 3.13.3 kept your lossless.
When the filter does strip, the standalone core decodes through libavcodec's float path (FLTP) rather than the S32P the resampler is set up for, so it was a net loss even where it fired.
The fix removes the dca_core core-strip entirely and decodes the full stream again: DTS-HD MA reconstructs its lossless XLL as S32P and re-encodes bit-perfectly to FLAC in .lossless (lossy EAC3 in .surroundCompat, unchanged). The per-packet EINVAL skip that handles the genuinely undecodable residual-without-core frame is kept (that is the real fix for #64). The bridge also re-derives the resampler input from each decoded frame now (the same thing the software audio decoder already does), so a stream whose sample_fmt was unresolved at open, or a live MPEG-TS probe that bailed before decoding audio, can no longer misread the samples.
Shipped in:
4.0.2 (main line)
3.13.6 (3.13.x maintenance line, if you want the fix without the 4.0.0 PlaybackState.ended source break)
No FFmpegBuild change is needed; the dca_core filter is simply no longer used (the dca decoder is unaffected).
One honest caveat: there is no DTS-HD MA encoder, so I cannot synthesize an offline fixture for it. I verified the full decode then FLAC re-encode path end-to-end on plain DTS, and the DTS-HD MA bit-perfectness holds by construction (the decoder reconstructs the lossless XLL as S32P, which FLAC preserves). A confirmation from you on a real disc would close it out, and if anything is still off a log line would help.
Activity
chore(release): 4.0.2 — DTS-HD MA lossless XLL restored (#66)
fix(audio): decode DTS-HD MA losslessly, drop the dca_core core-strip (…
chore(release): 3.13.6 — DTS-HD MA lossless XLL restored (#66, maint …
superuser404notfound commentedon Jun 25, 2026
Thanks for the precise report and the analysis, you were right on the core point.
4.0.1 (and 3.13.5) ran every DTS source through the
dca_corebitstream filter, which strips each packet to its lossy DTS core before the decoder. For a DTS-HD MA stream that decodes the full XLL cleanly, that threw the lossless extension away and the FLAC bridge re-encoded the lossy core, exactly the regression you described.Two things made the bitstream filter the wrong lever in hindsight:
avformat_find_stream_infodecodes a probe frame at open and writes the realsample_fmt(S32P for DTS-HD MA) back into the codec parameters, so the bridge's resampler was seeded correctly and the pre-3.13.4 full-decode path was genuinely lossless. That is why holding at 3.13.3 kept your lossless.The fix removes the
dca_corecore-strip entirely and decodes the full stream again: DTS-HD MA reconstructs its lossless XLL as S32P and re-encodes bit-perfectly to FLAC in.lossless(lossy EAC3 in.surroundCompat, unchanged). The per-packetEINVALskip that handles the genuinely undecodable residual-without-core frame is kept (that is the real fix for #64). The bridge also re-derives the resampler input from each decoded frame now (the same thing the software audio decoder already does), so a stream whosesample_fmtwas unresolved at open, or a live MPEG-TS probe that bailed before decoding audio, can no longer misread the samples.Shipped in:
PlaybackState.endedsource break)No FFmpegBuild change is needed; the
dca_corefilter is simply no longer used (thedcadecoder is unaffected).One honest caveat: there is no DTS-HD MA encoder, so I cannot synthesize an offline fixture for it. I verified the full decode then FLAC re-encode path end-to-end on plain DTS, and the DTS-HD MA bit-perfectness holds by construction (the decoder reconstructs the lossless XLL as S32P, which FLAC preserves). A confirmation from you on a real disc would close it out, and if anything is still off a log line would help.
fix(audio): decode DTS-HD MA losslessly, drop the dca_core core-strip (…