mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-21 22:15:40 +00:00
d8f3014957
Both count_mono_frames_from_audio_bytes and decode_scan_pcm started with the same ~25 LOC of Symphonia setup (Cursor → MediaSourceStream → probe → track-select with two fallbacks → codec_params → decoder). Extract that into open_decode_session(bytes) returning a DecodeSession struct (format + decoder + track_id + timeline_hint). Behaviour delta: count_mono_frames_from_audio_bytes previously failed silently if the decoder couldn't be built (.ok()?). Now it logs the same `[analysis] decoder make failed: …` line that decode_scan_pcm already emitted. Same return value (None), only an extra debug-print. Net: -38 +32 in compute.rs. Both call sites now read as a single line of setup followed by their loop.