Skip to content

Stream history: migrate off the legacy float listener path - #1695

Merged
Mysticial merged 2 commits into
mainfrom
stream-history-working-migration
Oct 24, 2026
Merged

Mysticial merged 2 commits into
mainfrom
stream-history-working-migration

Conversation

@pa-devbot

Copy link
Copy Markdown
Collaborator

Migrates stream history (the existing code on main) fully onto the audio pipeline's working stream, ahead of the legacy float-path removal.

What

  • StreamHistorySession no longer implements AudioFloatStreamListener: the base, on_samples(), and the AudioFloatStreamListener(1) constructor entry are dropped, along with the expected_samples_per_frame plumbing in initialize() (the legacy framing values are read by nothing once the legacy attach is gone).
  • ConsoleSystemSession no longer calls add/remove_stream_listener(m_history); the working-stream attach (set_audio_session + attach_working_listener, kept) is now the only audio feed into the session.
  • The working-stream funnel itself is unchanged: push_samples() still re-interleaves the planar stream to the active preset's shape and forwards to tracker->on_samples(), so StreamHistoryTracker_SaveFrames/Null record exactly as before. Behavior on main is unchanged; the only observable difference is that the legacy float path (which was feeding the same tracker, whose audio capture is #if 0'd in StreamHistoryTracker_SaveFrames) is no longer attached.

Why first

This removes the last consumer of the legacy float path, so the removal checklist from the audio pipeline hand-off (AudioFloatStreamListener, AudioStreamToFloat, the AudioSource reader, the pair's SampleListener/m_stream_listeners, AudioSession::add/remove_stream_listener) can follow in a separate PR that lands after this one. PR #1563 (the ffmpeg ring) will rebase on top of this once it's in; its stream-history-side hunks become the ring-specific #if additions only.

Also included (independent, 1 line)

The second commit fixes a pre-existing flake in the WAV loader tests: 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 (probe failed for the S16 44100 stereo wav — seen once in a full-suite run; the on-disk file at failure time was byte-for-byte the rate-mismatch test's version). The rate-mismatch test now uses its own temp file name.

Verified

  • pa-build green.
  • Full pa-test command-line suite: 18,272 passed / 0 failed / 3 skipped (skips are the decode-backend tests, unavailable in the container). The flake repro'd and then stayed green after the fix.

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.
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.
@Mysticial
Mysticial merged commit 52af2d6 into main Oct 24, 2026
7 checks passed
@Mysticial
Mysticial deleted the stream-history-working-migration branch October 24, 2026 04:23
Mysticial added a commit that referenced this pull request Oct 24, 2026
* Audio pipeline: remove the legacy float stream path

With stream history migrated to the working stream (#1695), the legacy
AudioFloatStreamListener path has no consumers left; delete it per the
removal checklist in the audio pipeline hand-off doc:

- Delete AudioStream.h/.cpp: AudioFloatStreamListener and
  AudioStreamToFloat. sample_size() (declared in AudioInfo.h, used by
  the sink gate tests) moves its definition to AudioInfo.cpp; the
  buffer-size constant had no other users.
- AudioSource: drop the AudioStreamToFloat reader, the InternalListener
  relay, the float add/remove_listener, samples_per_frame(),
  m_sample_rate/m_channels/m_multiplier, the preset switch in init(),
  and the now-unused volume_multiplier constructor argument (input
  volume rides the tree's RawAudio2WorkingAudio decoder, as before).
  The raw-stream accessors (raw_sample_rate/raw_channels/
  raw_sample_format, add/remove_raw_listener) are unchanged - the
  pipeline tree consumes the raw stream exactly as it did.
- AudioInputFile / AudioInputDevice: no longer fed by the reader; the
  double-feed (m_reader.push_bytes) in on_buffer_ready / writeData is
  gone - the raw RawAudioStreamListener output is untouched.
- AudioPassthroughPairQt: drop the SampleListener relay,
  m_sample_listener (and every reset()/new in the source/sink
  lifecycle paths), m_stream_listeners, and the float
  add/remove_listener overloads. AudioPassthroughPair (base) and
  AudioPassthroughPairQtThread lose the matching virtuals /
  forwarders.
- AudioSession: drop add/remove_stream_listener.
- SinkPipeline_Tests.h: the gate tests have been self-contained kernel
  chains since #1668; update the stale doc comment that still
  described a raw-byte comparison against the legacy converter chain.
- TestProgramComputer: drop the now-unused AudioStream.h include;
  StreamHistorySession: drop a stale commented-out
  expected_samples_per_frame line.

No behavior change for the pipeline tree, the sink/FFT branches, or the
working-stream listeners: the raw byte stream reaching the source
decoder is byte-identical to before (the legacy reader only tapped it
in parallel, with no consumer).

Verified: pa-build green (-Wall -Wextra -Wpedantic -Werror), full
pa-test suite 18,272 passed / 0 failed / 3 skipped (decode-backend
skips, unavailable in the container).

* fix

---------

Co-authored-by: PA Dev Bot <344001113+pa-devbot@users.noreply.github.com>
Co-authored-by: Alexander Yee <a-yee@u.northwestern.edu>
Mysticial pushed a commit that referenced this pull request Oct 24, 2026
…sandbox fossils (#1699)

* Nuke the dead audio stream conversion kernels and TimeSample tools.

Follow-up to the StreamHistory migration (#1695) and the legacy float
path removal (#1698); two pieces of the old audio stack are now
unreferenced:

- Kernels/AudioStreamConversion: the convert_audio_* raw sample-format
  kernels. The only call site in the tree was a #if 0 block in
  TestProgramComputer (removed with the include); the live pipeline
  converts formats through Kernels/AudioStreamConverter instead.
- AudioPipeline/Tools/TimeSampleBuffer, TimeSampleBufferReader and
  TimeSampleWriter: the old fault-tolerant timestamped sample buffer
  the pre-migration stream history recording rode on. No references
  remain anywhere in the source.

Both are dropped from SourceFiles.cmake; TestProgramComputer also
loses its stale StreamConverters.h include (the header itself is kept -
AudioInputDevice inherits from MisalignedStreamConverter /
ObjectStreamListener).

Full suite: 18,276 passed / 0 failed / 0 skipped.

* Sweep the dead audio-system fossils from TestProgramComputer.

The dev sandbox kept early versions of the pre-pipeline audio classes.
Remove the #if 0 block using the long-deleted AudioSourceReader /
AudioListener / AudioSampleFormat (plus the commented-out
AudioStreamReader2 line) and the stale AudioConstants.h include (none
of its constants are used in the file). The sandbox's #if 0 blocks that
exercise the current kernels are left in place.

Full suite: 18,276 passed / 0 failed / 0 skipped.

---------

Co-authored-by: PA Dev Bot <344001113+pa-devbot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants