Repository navigation
Audio: FLAC decoded in the app and fed as PCM (stereo, up to 48 kHz) - #950
Merged
Merged
Conversation
libpf has no FLAC input, but takes raw PCM through contents.pcmInfo. A FLAC track of up to two channels is decoded with the bundled FFmpeg's flac decoder and fed as S16LE/S32LE at the rate PMS reports; the Load refuses when the facts are missing or the file contradicts them. devcaps admits flac only on a read table, capped at 2 channels, so PMS still converts a 5.1 FLAC. Verified on an OLED55B8 (webOS 4.4.3): a 24-bit/48 kHz FLAC direct-plays, PMS reports no transcode. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BNxR112kqmb5uZjUzXgND1 Signed-off-by: Paulo Richards <[email protected]>
- ff_pcm reads AVFrame through ff.rs's offsets; nb_samples joins them and ci/ffabi-assert.c pins it on both pointer widths. - pcm_info_tests no longer splits sink_envelope_tests from its doc comment. - devcaps says what was verified (webOS 4.4.3) instead of every set. - ci/list-caps.ini classifies PCM_MAX_CHANNELS as a format limit. - THIRD-PARTY-NOTICES: the bundled FFmpeg now enables the FLAC decoder. Signed-off-by: Paulo Richards <[email protected]>
Signed-off-by: Paulo Richards <[email protected]>
Signed-off-by: Paulo Richards <[email protected]>
Measured on an OLED55B8 (webOS 4.4.3) with test clips: - A 96 kHz or 192 kHz FLAC, declared as such in pcmInfo, played audibly slow (192 kHz slower still) with no error from the pipeline; 44.1 and 48 kHz played right. libpf's LUT_SampleRateType lists 8/12/16/22.05/ 24/32/48 kHz. devcaps::PCM_SAMPLE_RATES holds that set plus 44.1 kHz; the profile caps FLAC at audio.samplingRate=48000 so PMS converts above it. - Under Force Direct Play a 5.1 FLAC direct-played and the Load was then refused. The PCM path's limits (two channels, the rate set) are the app decoder's and LG's PCM input's, not a hardware decoder's, so the planner applies them in both modes (devcaps::pcm_track_fits) and a forced start refuses with the codec named, as for TrueHD. The audio gates take the track's sampling rate alongside its channels. Signed-off-by: Paulo Richards <[email protected]>
…ose the decoder made false Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Drop the duplicate avcodec send/receive entries, the duplicate nb_samples offset and its ffabi-assert lines (the speed decoder's OFF_AFRAME_NB_SAMPLES serves both). At a speed other than 1x the speed decoder takes FLAC too: the FLAC PcmDecoder is not opened and the Load carries only the speed decoder's pcmInfo. Reword the decoder comments and docs that this made false. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Collaborator
|
Thanks for the FLAC work, @paulorichards, and for the patience while it was brought up to date with main. Merged. Changes made on the way in: FLAC at a speed other than 1x now goes through the playback-speed decoder instead of opening a second one, the Load payload carries exactly one |
Dr-Amp
pushed a commit
to Dr-Amp/plx-native
that referenced
this pull request
Oct 24, 2026
Brings upstream main (e87ca65: FLAC decoded in the app and fed as PCM, plxnative#950) into the Opus branch. Conflicts, each resolved by keeping both sides: - Load audio code: upstream's FLAC PCM already takes 5, so Opus moves to 6 (audio_payload_codec, load_a_str, and the Opus Load test). - devcaps: forced_feeds_audio admits pipeline-only Opus and app-decoded FLAC on a read table. The audio list is DP_AUDIO_CODECS's subset, then Opus, then flac. OPUS_AUTO_MAX_CHANNELS and PCM_MAX_CHANNELS are both classified in ci/list-caps.ini. - engine: the opusInfo helpers and upstream's pcmInfo helpers are both kept. Signed-off-by: Dr-Amp <[email protected]>
Dr-Amp
pushed a commit
to Dr-Amp/plx-native
that referenced
this pull request
Oct 24, 2026
Brings upstream main (e87ca65: FLAC decoded in the app and fed as PCM, plxnative#950) into the Live TV branch. The Opus-side conflicts are the ones the Opus branch resolved (its merge commit 9011407): Opus load code 6, FLAC PCM code 5, both list-caps entries, both devcaps gates, both engine helper sets. The Live TV side only adds the live-channel seek refusal in player/mod.rs. Replay recordings are not re-recorded for the screen pin. That still needs the macOS simulator, so the replay gate is not green on this branch. Signed-off-by: Dr-Amp <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Oct 24, 2026
Brings in the Browse B-A section-hubs job and the other changes main gained since fba7a81 (#1017, #1021, #950). Five files conflicted and every one keeps both sides: the Direct arm of StoreJob::admission() lists BrowseHubs, MetaSeason and MetaEpisodes; the runner and the Held docs name both the Browse and the Metadata kinds; bridge.rs's late-job messages name every drain of both stores; docs/sans-io.md numbers Metadata as the tenth store; PINNED_LEDGER_TOTALS is the real sum of the # count: headers (the textual merge produced a wrong-looking pair). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
5 tasks done
GLinnik21
pushed a commit
that referenced
this pull request
Oct 25, 2026
The FLAC path (#950) declared `pcmInfo.sampleRate` in Hz (`48000`). libpf matches that field against a kilohertz table (`48`, `44.1`, `32`, ...) and falls back to 44.1 for a value it cannot match, so every FLAC that was not 44.1 kHz played at the wrong pitch: on a B8 a 1 kHz tone in a 48 kHz file came back at 918.8 Hz. `with_pcm_info` now declares the rate in kHz, as the speed path already did, and the measured tone comes back at 999.96-999.99 Hz at 48, 44.1, 32 and 22.05 kHz. - `pcm_rate_khz` converts the rate (`48000` -> `48`, `44100` -> `44.1`, `22050` -> `22.05`). - New test `the_sample_rate_is_declared_in_kilohertz` covers every rate in `PCM_SAMPLE_RATES`; the two payload tests now expect `48` and `44.1`. - `PCM_SAMPLE_RATES` keeps its 48 kHz ceiling: a test build declaring 88.2-192 kHz in kHz still played at 44.1, because libpf's table stops at 48. Co-Authored-By: Claude Opus 5.5 <[email protected]>
tiper
added a commit
to tiper/fin-native
that referenced
this pull request
Oct 26, 2026
…f alone Upstream's plxnative#992 and plxnative#1034 now feed stereo Opus to the television's own decoder, with the per-firmware exclusions and the learned refusals, and plxnative#950 feeds FLAC as PCM. That replaces FinNative's own native FLAC, Opus and Vorbis feed, which this commit used to carry: on the C1 its native FLAC was stereo only, where the PCM route already plays it, and Vorbis was refused at every channel count. What remains is the one rule the conversion needs beside them: with Convert audio on the TV, a track the TV's table decodes at its channel count is fed as it is, not converted to AC3. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.
Closes #917. Part of #918.
libpf has no FLAC input (its Load vocabulary is AAC, AC3, AC3 PLUS, DTS, MP3, MPEG, OPUS, VORBIS, WMA and PCM), but it takes raw PCM through
contents.pcmInfo. This decodes FLAC in the demuxer with the bundled FFmpeg and feeds it as PCM, so a stereo FLAC track direct-plays in Auto and in Force Direct Play instead of being converted by the server.Change
ci/build-ffmpeg.shenables the FLAC parser and decoder (LGPL). No encoder, no libswresample, no new library.THIRD-PARTY-NOTICES.mdsays so.ff_pcmopens FFmpeg's FLAC decoder and turns its frames into interleaved little-endian PCM: up to 16 bits as S16LE, anything deeper (or unstated) as S32LE, left-justified as the decoder produces it. Both are bit-exact. The decoder refuses a stream whose own rate or channel count contradicts what the Load declared.PCMand carriespcmInfo(format,channelMode,layout,sampleRate,bitsPerSample), built from the PMS track facts (route::stream_pcm).StreamandCarriedAudionow carrysamplingRateandbitDepthfrom PMS.devcaps:PCM_MAX_CHANNELS = 2(channelModehas nothing wider) andPCM_SAMPLE_RATES, the rates that play at their own speed (libpf'sLUT_SampleRateType: 8, 12, 16, 22.05, 24, 32, 48 kHz, plus 44.1 kHz).pcm_track_fitschecks a track against both.pcm_track_fitsin Auto and in Force Direct Play. These are limits of our decoder and LG's PCM input, not of a hardware decoder that Forced may trust past its table, so a 5.1 or 96 kHz FLAC is refused under Forced with the codec named (as for TrueHD) instead of failing at the Load. The audio gates take the track's sampling rate alongside its channels.flacfor direct play only when the device table was read (Caps::assumed()is unchanged), withaudio.channels≤ 2 andaudio.samplingRate≤ 48000, so PMS converts anything wider or faster. FLAC is never a transcode target.AVFrame.nb_samplesjoins the shared offsets inff.rsand is pinned inci/ffabi-assert.c;ff_pcmis in the media layer.Verification
git statusempty before and after):make checkok (104 steps — all ok, its hostsim pass1872 passed; 0 failed; 64 ignored),make check-nodefok, ARMmake FLAVOR=stable RELEASE=1 ipkok (check-packaged-elf.pyPASS).ff_pcminterleaving (packed and planar, 16 to 32 widening, 24-bit in S32 kept exact);pcm_format_ofandwith_pcm_info; devcapsflac_is_pcm_decoded_stereo_only_and_only_on_a_read_tableandthe_pcm_path_admits_only_the_rates_and_channels_it_plays_correctly; plannerflac_is_gated_by_the_pcm_paths_own_limits_in_both_modes; transcoderflac_is_offered_for_direct_play_up_to_stereo_and_never_as_a_target. They were written alongside the code, so I haven't seen them red.TV check (LG OLED55B8, webOS 4.4.3, RELEASE build of this branch, real PMS 1.43.4)
Test clips: 2 minutes of Tears of Steel (CC BY 3.0, Blender Foundation), the same 1080p H.264 video with the audio re-encoded from Blender's 24-bit / 48 kHz masters. Force Direct Play unless noted.
demuxthreadDIRECT PLAY, PCM 48 kHz S32DIRECT PLAY, PCM 44.1 kHz S16DIRECT PLAY, PCM 48 kHz monoDIRECT PLAY, DTS coreCPU is per thread from
/procover 90 s, % of one core. Every PCM feed was accepted (reply=O). Three seeks on the 48 kHz clip (forward, back, near the end) returnedrv=0in 137 to 301 ms, with audio back and in sync.The 96 and 192 kHz rows are what made me add the rate limit. Before it, both were declared in
pcmInfoand played audibly slow (192 kHz slower), with no error anywhere.smp_cbreports44.099998for every PCM Load, including 48 kHz ones that play right, so it doesn't show the rate in use.Not verified:
🤖 Generated with Claude Code
https://claude.ai/code/session_01BNxR112kqmb5uZjUzXgND1