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
+4 -1
View File
@@ -7,8 +7,11 @@
#include "cJSON.h"
#include "esp_err.h"
typedef enum { PLAYER_SRC_TONE, PLAYER_SRC_OFF, PLAYER_SRC_HLS, PLAYER_SRC_SPOTIFY } player_src_t;
esp_err_t player_init(void);
// Apply the "source" config group (mode etc.).
void player_apply(const cJSON *source);
// Source side: write 48 kHz stereo int32 frames, blocking while the ring is full.
size_t player_write(const int32_t *frames, size_t n);
// Frames from a source that is not the active one are dropped (returns n).
size_t player_write(player_src_t src, const int32_t *frames, size_t n);