Step 7.5b3a: per-source PCM converter (audio_out), shared by HLS and Spotify

- main/audio_out: one converter instance per source (own rate converter
  state): s16 any rate/channels -> 48 kHz stereo int32 -> ring.
- player_write(src, ...) only writes for the active source, drops the
  rest; player_src_t is public in player.h.
- HLS decoder uses audio_out (no behaviour change).
- Verified: HLS still sample exact (441344 -> 480375 frames per
  10.008 s segment), buffer ~4 s, 0 underruns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 18:34:15 +10:00
parent c240ac9a3c
commit 5b0d7c9ba4
6 changed files with 131 additions and 73 deletions
+15
View File
@@ -0,0 +1,15 @@
// PCM from a source (s16, any rate/channels) -> 48 kHz stereo int32 -> player ring.
// One converter per source: each keeps its own resampler state.
#pragma once
#include <stddef.h>
#include <stdint.h>
#include "player.h"
typedef struct audio_conv audio_conv_t;
audio_conv_t *audio_conv_create(player_src_t src, const char *name);
// Blocks while the ring is full; dropped when src is not the active source.
// Returns the 48 kHz frames produced.
size_t audio_conv_write(audio_conv_t *c, const int16_t *pcm, uint32_t frames, int channels, uint32_t rate);