From e6d341b89553ef2652c7a02eb8f13026ce272dd0 Mon Sep 17 00:00:00 2001 From: PA Dev Bot <344001113+pa-devbot@users.noreply.github.com> Date: Sat, 24 Oct 2026 04:08:16 +0000 Subject: [PATCH 1/2] Stream history: migrate off the legacy float listener path StreamHistorySession now consumes only the audio pipeline's working stream: - drop the AudioFloatStreamListener base, on_samples() and the AudioFloatStreamListener(1) constructor entry; - drop the add/remove_stream_listener(m_history) legacy attaches in ConsoleSystemSession (the working-stream attach is kept); - drop the expected_samples_per_frame plumbing in initialize() - the legacy framing values are no longer read by anything. The working-stream funnel (push_samples -> re-interleave -> tracker::on_samples) is unchanged, so the mainline trackers record exactly as before. This removes the last consumer of the legacy float path, so its removal checklist (AudioFloatStreamListener, AudioStreamToFloat, the AudioSource reader, the pair's SampleListener, AudioSession::add/remove_stream_listener) can follow in a separate PR. --- .../Recording/StreamHistorySession.cpp | 19 ++----------------- .../Recording/StreamHistorySession.h | 6 +----- .../Framework/ConsoleSystemSession.cpp | 2 -- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/SerialPrograms/Source/CommonFramework/Recording/StreamHistorySession.cpp b/SerialPrograms/Source/CommonFramework/Recording/StreamHistorySession.cpp index 0ed1f96414..93a6e72764 100644 --- a/SerialPrograms/Source/CommonFramework/Recording/StreamHistorySession.cpp +++ b/SerialPrograms/Source/CommonFramework/Recording/StreamHistorySession.cpp @@ -65,8 +65,7 @@ StreamHistorySession::StreamHistorySession(Logger& logger) // The working-stream nominal shape is metadata only: the pair's // per-listener forwarder carries the shape actually requested, and // nothing validates this one. - : AudioFloatStreamListener(1) - , Kernels::AudioPipeline::WorkingAudioStreamListener(48000, 2) + : Kernels::AudioPipeline::WorkingAudioStreamListener(48000, 2) , m_data(CONSTRUCT_TOKEN, logger) {} void StreamHistorySession::start(AudioChannelFormat format, bool has_video){ @@ -114,13 +113,6 @@ bool StreamHistorySession::save(const std::string& filename) const{ return tracker->save(filename); } -void StreamHistorySession::on_samples(const float* samples, size_t frames){ - Data& data = *m_data; - WriteSpinLock lg(data.m_lock); - if (data.m_current){ - data.m_current->on_samples(samples, frames); - } -} void StreamHistorySession::push_samples(size_t samples, size_t stride, const float* data){ Data& state = *m_data; WriteSpinLock lg(state.m_lock); @@ -177,42 +169,35 @@ void StreamHistorySession::initialize(){ // stream shape (what the tree delivers through the working listener), // not the preset's legacy framing. (DUAL_44100 was previously // misreported as mono; MONO_96000 was previously framed as 2-sample - // frames at 48000.) "expected_samples_per_frame" keeps the legacy - // framing values for the AudioFloatStreamListener path. + // frames at 48000.) switch (data.m_audio_format){ case AudioChannelFormat::NONE: - expected_samples_per_frame = 0; data.m_active_channels = 0; data.m_active_rate = 0; data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 0, 0, data.m_has_video)); return; case AudioChannelFormat::MONO_48000: - expected_samples_per_frame = 1; data.m_active_channels = 1; data.m_active_rate = 48000; data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 1, 48000, data.m_has_video)); return; case AudioChannelFormat::DUAL_44100: - expected_samples_per_frame = 2; data.m_active_channels = 2; data.m_active_rate = 44100; data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 2, 44100, data.m_has_video)); return; case AudioChannelFormat::DUAL_48000: - expected_samples_per_frame = 2; data.m_active_channels = 2; data.m_active_rate = 48000; data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 2, 48000, data.m_has_video)); return; case AudioChannelFormat::MONO_96000: - expected_samples_per_frame = 2; data.m_active_channels = 1; data.m_active_rate = 96000; data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 1, 96000, data.m_has_video)); return; case AudioChannelFormat::INTERLEAVE_LR_96000: case AudioChannelFormat::INTERLEAVE_RL_96000: - expected_samples_per_frame = 2; data.m_active_channels = 2; data.m_active_rate = 48000; data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 2, 48000, data.m_has_video)); diff --git a/SerialPrograms/Source/CommonFramework/Recording/StreamHistorySession.h b/SerialPrograms/Source/CommonFramework/Recording/StreamHistorySession.h index dae2f2bcc8..036265815c 100644 --- a/SerialPrograms/Source/CommonFramework/Recording/StreamHistorySession.h +++ b/SerialPrograms/Source/CommonFramework/Recording/StreamHistorySession.h @@ -19,8 +19,7 @@ namespace PokemonAutomation{ class StreamHistorySession - : public AudioFloatStreamListener - , public Kernels::AudioPipeline::WorkingAudioStreamListener + : public Kernels::AudioPipeline::WorkingAudioStreamListener , public VideoFrameListener , public AudioSession::StateListener , public VideoSession::StateListener @@ -36,9 +35,6 @@ class StreamHistorySession void set_audio_session(AudioSession& session); public: - // Legacy float stream (kept until the remaining float consumers - // migrate; see the audio pipeline hand-off doc). - virtual void on_samples(const float* data, size_t frames) override; // Working stream, delivered in the shape requested at attach time // (the active preset's physical shape), split (planar) channels. virtual void push_samples(size_t samples, size_t stride, const float* data) override; diff --git a/SerialPrograms/Source/GameConsole/Framework/ConsoleSystemSession.cpp b/SerialPrograms/Source/GameConsole/Framework/ConsoleSystemSession.cpp index bc420dda97..9d6e257359 100644 --- a/SerialPrograms/Source/GameConsole/Framework/ConsoleSystemSession.cpp +++ b/SerialPrograms/Source/GameConsole/Framework/ConsoleSystemSession.cpp @@ -29,7 +29,6 @@ bool ConsoleSystemSession::try_shutdown() noexcept{ m_video.remove_state_listener(m_history); m_video.remove_state_listener(m_history); - m_audio.remove_stream_listener(m_history); m_audio.remove_working_stream_listener(m_history); m_audio.remove_state_listener(m_history); @@ -88,7 +87,6 @@ ConsoleSystemSession::ConsoleSystemSession( m_overlay.add_stat(*m_main_thread_utilization); m_audio.add_state_listener(m_history); - m_audio.add_stream_listener(m_history); m_video.add_state_listener(m_history); m_video.add_frame_listener(m_history); From 9fa52b2a5a0262ca732d641b10ab1a0c912b969d Mon Sep 17 00:00:00 2001 From: PA Dev Bot <344001113+pa-devbot@users.noreply.github.com> Date: Sat, 24 Oct 2026 04:08:16 +0000 Subject: [PATCH 2/2] Audio pipeline tests: give the rate-mismatch WAV its own temp file LoadFull_RateMismatch and WavParse_PcmFormats both wrote the same /tmp/pa_wav_test_s16_44100_2ch.wav while running in parallel, so one could truncate the file out from under the other's probe and fail intermittently ('probe failed for the S16 44100 stereo wav'). Give the rate-mismatch test a unique temp file name. --- .../CommonFramework/AudioPipeline/IO/AudioFileLoader_Tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioFileLoader_Tests.cpp b/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioFileLoader_Tests.cpp index ba51f62b79..fa86d0f793 100644 --- a/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioFileLoader_Tests.cpp +++ b/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioFileLoader_Tests.cpp @@ -318,7 +318,7 @@ class LoadFullRateMismatchTest : public UnitTest{ virtual UnitTestResult run(Logger& logger, CancellableScope& scope) const override{ const std::vector samples = {0, 1, 0, 1}; - const std::string path = temp_wav_path("s16_44100_2ch"); + const std::string path = temp_wav_path("s16_44100_2ch_rate_mismatch"); write_wav_file(path, 1, 2, 44100, 16, to_bytes(samples)); QAudioFormat target;