Repository navigation
FLAC PCM: declare sampleRate in kHz - #1036
paulorichards wants to merge 2 commits into
Conversation
|
Nice, same conclusion here! #1032 is the same change (with the C1 / webOS 6.5.3 results: 48, 32 and 22.05 kHz now on time). Between the two we've got it confirmed on webOS 4.4 and 6. Happy for @GLinnik21 to take whichever he prefers and close the other. |
|
Had a closer look and this PR does the same thing in fewer files and works the kHz out from any rate, so it's the better one. Closing #1032 |
|
@paulorichards please keep this one. Its a better approach 😄 |
libpf matches pcmInfo.sampleRate against a kilohertz table (GLinnik21#805). The FLAC node stated hertz, so every FLAC played at the 44.1 kHz fallback: on an OLED55B8 (webOS 4.4.3) a 1 kHz tone came back at 918.8 Hz from a 48 kHz file, 1378 Hz from 32 kHz and about 2006 Hz from 22.05 kHz. Declared in kHz, all four rates play at 1000 Hz and the pipeline reports the declared rate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BNxR112kqmb5uZjUzXgND1 Signed-off-by: Paulo Richards <paulo.richards@gmail.com>
|
Our comments crossed, sorry about that. Reopening as you suggest, thanks! With your C1 results we have it confirmed on webOS 4.4 and 6.5. |
…innik21#1032) The rate doc, the track gate and the planner's refusal said the PCM input plays some rates "at their own speed". What decides it is whether pcmInfo.sampleRate names a rate in libpf's kilohertz table, so they say that now, and the comments carry the C1 (webOS 6.5.3) results next to the B8 ones. Co-authored-by: Tiago Pereira <1698241+tiper@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BNxR112kqmb5uZjUzXgND1 Signed-off-by: Paulo Richards <paulo.richards@gmail.com>
a538488 to
9fb4326
Compare
|
I've also brought over your wording from #1032: the rate doc, the gate and error messages now say a rate is one the table "names" instead of one that plays "at its own speed", and the comments include your C1 results (GStreamer caps |
The FLAC path in #950 declared
pcmInfo.sampleRatein the wrong unit, so the TV played every FLAC at 44.1 kHz. This PR declares it in kHz, and a measured test tone now comes back at the right pitch at every rate I tried.When I tested #950, I checked 48 kHz by ear and by comparing the feed timestamps against the wall clock. Both looked fine, but neither could catch this: the timestamps follow the clock the input keeps, not the pitch, and 919 Hz instead of 1000 Hz is hard to hear without something to compare it to.
@tiper then noticed in #917 that on a C1 every FLAC played at 44.1 kHz, whatever rate was declared. So I tested again on my B8 (OLED55B8, webOS 4.4.3), this time measuring instead of listening. I made FLAC clips at each rate with a 1 kHz tone, then 440 Hz + 5 kHz, then a 2 kHz beep every 10 s, played them on the TV, recorded the room with a laptop mic, and measured the tone's frequency. A wrong rate shifts the tone by the ratio between the file's rate and the one played. To check the method, an AAC 48 kHz clip decoded by the TV came back at 999.98 Hz, and a 48 kHz file relabelled as 44.1 kHz came back at 918.74 Hz, as it should. The B8 did the same as the C1: 918.8 Hz from 48 kHz, 1377.9 Hz from 32 kHz and about 2006 Hz from 22.05 kHz, which is exactly 1000 × 44.1 / the file's rate.
The reason was already in #805: @dimitrije83 found there that libpf matches
sampleRateagainst a kilohertz table (48,44.1,32, ...) and falls back to 44.1 for a value it can't match. The speed path declares48. The FLAC path declared48000, which matches nothing, so 44.1 kHz files sounded right by accident and every other rate didn't.With the rate declared in kHz, the same clips measured:
The 440 Hz and 5 kHz tones measured 440.0 and 4999.9 Hz, and all 8 beeps were 10.000 s apart on every file. The last column comes from the pipeline's audio-info callback (
smp_cb type=8). For the relabelled control it said 44.099998, so it shows the rate the TV really used.I also checked whether the 48 kHz ceiling was the same unit problem. It isn't. A test build that admitted 88.2, 96, 176.4 and 192 kHz and declared them in kHz still played all four at 44.1: the tone came back at about 504, 457, 246 and 234 Hz, against 500, 459, 250 and 230 predicted by the fallback, and for 192 kHz the TV reported 44.099998. libpf's table stops at 48, so
PCM_SAMPLE_RATESstays as it is and faster files stay a server conversion.Change
with_pcm_infostates the rate in kHz, the same unit the speed path uses.pcm_rate_khzconverts it (48000→48,44100→44.1,22050→22.05).the_sample_rate_is_declared_in_kilohertzchecks every rate inPCM_SAMPLE_RATES. The two payload tests that expected48000and44100now expect48and44.1.PCM_SAMPLE_RATESdoc indevcaps.rsno longer says 48 kHz played right on the B8.Nothing is resampled, so this adds no CPU.
Tests
make test-crate C=plx-media T=player::engine(51 passed)make test-crate C=plx-platform T=pcmmake FLAVOR=stable RELEASE=1 ipkmake checkmake check-nodefNot verified
🤖 Generated with Claude Code
https://claude.ai/code/session_01BNxR112kqmb5uZjUzXgND1