- Updateurequest dependency from v2 to latest major (v3.14)
- Add ureq as optional dependency in pmoaudio-ext
- Introduce is_continuous flag to UriSource and PlayerState for proper StreamType handling (Finite vs Continuous)
- Implement detect_continuous_stream() with URL pattern matching and HTTP HEAD header inspection (ICY, chunked encoding)
- Update send_track_boundary() to accept StreamType parameter
- Introduce `Streamtype` enum (Continuous vs Finite) to distinguish radio streams from finite tracks
- Enrich `TrackBoundary` sync marker with stream type for proper pause behavior per mode (silence vs backpressure)
- Update all sources and sinks to pass `StreamType` when creating track boundaries
- Radio Paradise, HTTP source → Continuous (infinite)
- Improve UPnP control architecture: pause sends silence for radio, blocks pipeline via backpressure for tracks
- Prepare groundwork for multi-client DSP architecture with shared source and per-DSP pipelines
- Ajout d'un BaseUrl layer dans pmoserver pour gérer les URLs absolues (LAN/WAN)
- Renommage de `covers_absolute_url_for` → ` covers_relative_route`, stocker les routes relatives
- Mise à jour des appels UPnP vers `covers_absolute_url_for_upnp` (fallback PMO_SERVER_URL)
- Correction des tâches de fond pour stocker les routes, pas l'URL complète
- Suppression du feature gate `simd` inutilisé dans pmoaudio/src/lib.rs
- Suppress dead code warnings for utility functions, enums and traits not yet used in production
- Reorganize imports to follow module conventions (e.g., `DeviceIdentity` moved earlier in openhome_renderer.rs)
- Improve formatting of ClientMessage variants for readability
These changes prepare codebase groundwork without altering runtime behavior.
- Comment out `use std::simd::*` in pmoaudio as it's unused and modules import their own SIMD
- Remove `Instant` from imports in track_metadata.rs (unused)
- Reorder anyhow import to match Rust convention (`anyhow, Result` → `Result`) and remove unused imports
- Improve XML response logging readability with line breaks in iterator chain
+ Refactor `get()` method to multi-line for clarity and consistency
Refactor the audio pipeline to support multi-client streaming with new OggFlacStreamHandle and StreamingOggFlacSink.
- Replace DirectOggFlacSink with StreamingOggFlacSink in pipeline
- Update documentation and comments to reflect multi-client support
- Add detailed warning logs for buffer underruns and client disconnections
- Remove TimerBufferNode from pipeline as it's no longer needed
- Update connect() calls to subscribe() for new streaming behavior
This change enables multiple clients to subscribe to the same audio stream, with each subscription getting a live feed from the current point in time.
Cette mise à jour refactorise les nœuds audio pour utiliser la méthode `boxed()` lors de l'enregistrement des enfants, améliorant ainsi la cohérence et la lisibilité du code. Les méthodes `make()` sont ajoutées pour faciliter la création d'instances boxées des nœuds, et les exemples sont mis à jour en conséquence.
This commit refactors the WebRenderer to use a server-side streaming architecture with OGG-FLAC sink instead of the previous WebSocket-based approach. The changes include:
- Replaced WebSocket communication with HTTP streaming using DirectOggFlacSink
- Implemented a new pipeline architecture with dedicated handlers for UPnP commands
- Added new modules for registration, registry, and streaming
- Updated the renderer to work with a pipeline control system
- Removed old WebSocket session management
- Added support for HTTP streaming with gapless playback
- Updated dependencies and features for the new architecture
The WebRenderer now acts as a MediaRenderer UPnP device that serves audio streams via HTTP endpoints, with commands relayed to the audio pipeline through a new control system.
Investigation revealed the root cause of premature streaming termination:
1. MPSC Channel Size Issue:
- DEFAULT_CHANNEL_SIZE = 16 chunks × 50ms = 800ms capacity
- TimerNode max_lead_time = 3.0 seconds
- The channel fills up in 0.8s while TimerNode wants 3s buffer
- This creates stop-and-go pattern instead of smooth backpressure
2. Channel Closure Issue:
- When RadioParadiseStreamSource::process() returns, the Node
automatically closes output channels
- TimerNode receives EOF and terminates immediately
- Remaining chunks in MPSC buffer (up to 16) are never sent to sink
Added comprehensive tracing:
- RadioParadiseStreamSource: Track backpressure blocking, chunk counts,
decode timing
- TimerNode: Log all pacing decisions, sleep durations, lead time
- Both use trace! for high-frequency events, debug! for blocking
Next steps:
- Option A: Increase channel size to match max_lead_time
(60 chunks for 3s @ 50ms)
- Option B: Wait for channels to drain before closing
(use tx.closed().await)
- Option C: Both A and B for optimal behavior
The previous "wait for playback duration" fix is a valid workaround
but doesn't address the architectural issue.
Cleaned up excessive INFO logging that was added during debugging.
Logs are now properly categorized by verbosity:
- Frequent/repeated logs (every chunk) → TRACE
* TimerNode SLEEPING messages
* Broadcaster "Read X bytes" messages
- Occasional/setup logs → DEBUG
* Node::run() starting/spawning
* TopZeroSync received
* Cancelled during sleep
- Important events remain INFO
* Encoder initialization
* Header captured
* Stream ended
* Broadcaster task started
This makes INFO logs clean and useful for production monitoring,
while keeping detailed information available via DEBUG/TRACE levels.
Tested with RUST_LOG=info - output is now clean with only
meaningful events logged.
Affected files:
- pmoaudio/src/nodes/timer_node.rs: SLEEPING → trace, TopZeroSync → debug
- pmoaudio/src/pipeline.rs: Node::run/Spawning → debug
- pmoaudio-ext/src/sinks/streaming_flac_sink.rs: Read bytes → trace
Enhanced logging to INFO level for key TimerNode operations:
- TopZeroSync reception and timer reset
- Sleep operations when lead_time exceeds max_lead_time
- Warning when no timer is set (missing TopZeroSync)
This diagnostic logging confirmed that:
1. TopZeroSync is properly received from RadioParadiseStreamSource
2. TimerNode correctly calculates lead_time and sleeps ~48ms per 50ms chunk
3. Real-time pacing is working as expected (3.0s max lead time)
The backpressure mechanism is functioning correctly - chunks flow at
real-time speed (~50ms per chunk) rather than downloading at maximum speed.
Apply same architecture as FlacCacheSink to prevent file truncation
when external readers access files during encoding.
Changes:
1. Add pump_track_segments_from_channel() for parallel pump tasks
2. Refactor process() to use dispatcher + tokio::select! pattern
3. Create .complete marker after flush/wait to signal file is ready
4. Allow multiple tracks to encode in parallel (pump continues in background)
This ensures FlacFileSink is cache progressive compliant, meaning external
code can safely read output files while they're being written without
risk of truncation.
Changes:
- Add TimerNode (pmoaudio/src/nodes/timer_node.rs): Rate-limits audio chunk flow based on timestamps with configurable max_lead_time
- Integrate TimerNode into play_and_cache.rs pipeline: PlaylistSource → TimerNode (3s pacing) → AudioSink
- Improve EOF retry in playlist_source.rs: Wait for prebuffer (512KB) before decoding, retry on temporary EOF with 200ms delay
- Export TimerNode in pmoaudio lib.rs and nodes/mod.rs
Known issue: Cache files may still be truncated when TrackBoundary arrives before pump completes flushing.
This requires allowing parallel write tasks as suggested.
Problem Analysis:
- All FLAC files had the same pk (071c5713d5cf485ca688832207bef0f9)
- Root cause: read() can return < 1024 bytes on first call
- If read returned only 400 bytes:
* header.len() = 400
* 400 > 512 = false
* Used header[..] (first 400 bytes = FLAC header)
* All FLAC files have identical headers → same pk!
Solution:
- Added read_exact_or_eof() that loops until 1024 bytes read (or EOF)
- Guarantees we skip FLAC header and use actual audio content
- Works for small files (< 512 bytes) and large files (>= 1024 bytes)
Additional Feature:
- Added AudioSink::with_null_output() for testing without audio device
- Added --null-audio flag to play_and_cache example
- Allows testing in containerized environments
Changes:
1. pmocache/src/download.rs: Added read_exact_or_eof()
2. pmocache/src/cache.rs: Use read_exact_or_eof() for pk calculation
3. pmoaudio/src/nodes/audio_sink.rs: Added null output mode
4. pmoparadise/examples/play_and_cache.rs: Added --null-audio flag
Test Results:
- New pk: 83702c1cbca72074ebf7c123336786ea (was 071c...)
- Null audio output works correctly
- Ready for full testing
Problem:
- cpal::Stream is not Send
- Cannot use Stream across await points in async functions
- Caused compilation error in AudioSinkLogic::process
Solution:
- Spawn dedicated thread for cpal Stream (similar to rodio approach)
- Communicate with thread via std::mpsc channel
- Thread waits for shutdown command before dropping stream
- Main async loop can now safely await without Send issues
Changes:
- Add std::mpsc and std::thread imports
- Create stream_cmd channel (std::mpsc::channel)
- Spawn thread::spawn for stream creation and management
- Replace drop(stream) with stream_cmd_tx.send + thread.join
- Handle errors in thread with tracing::error (no ? operator)
Testing:
- Compiled successfully with libsoxr and libasound2 (local install)
- Dependencies installed in ~/.local without sudo
- PKG_CONFIG_PATH configured correctly
- LD_LIBRARY_PATH configured correctly
Note: pmoparadise example has unrelated netstat2 compilation issue
Changes:
- Remove all volume management (use VolumeNode in pipeline instead)
- Detect hardware format (I16/U16/F32) at startup
- Accept all AudioChunk formats (I16/I24/I32/F32/F64) as input
- Use optimized SIMD functions from dsp::int_float module
- SharedBuffer stores raw AudioChunk + intermediate F32 buffer
- Callbacks adapted to hardware format with proper conversion
Architecture:
1. AudioChunk pushed to SharedBuffer
2. Lazy conversion to F32 interleaved using dsp functions
3. Callback converts F32 → hardware format (I16/U16) if needed
Benefits:
- SIMD optimized conversions (dsp module)
- Clean separation of concerns (volume in VolumeNode)
- Hardware format detection (use native format when possible)
- Flexible input (accepts any AudioChunk type)
Note: Requires ALSA (libasound2-dev) on Linux for compilation
- Replace rodio dependency with cpal in pmoaudio/Cargo.toml
- Add AudioSink node using cpal for direct hardware access
- Add SharedBuffer for async/callback communication
- Convert all audio formats to F32 for cpal
- Improve latency and control over audio stream
- Add WHY_CPAL.md explaining the technical choice
- Update INSTALL_NOTES.md with ALSA requirements
- Export AudioSink in lib.rs and mod.rs
Benefits:
- Minimal latency (no extra layers)
- Direct hardware control
- Lighter binary (~3.8 MB less)
- Same ALSA dependency as rodio on Linux
- Cross-platform (ALSA/JACK on Linux, CoreAudio on macOS, WASAPI on Windows)
Implémente AudioSink qui permet la lecture audio en temps réel sur la sortie audio
standard via rodio avec architecture thread-safe.
- Nouveau nœud AudioSink avec thread dédié pour gérer rodio (OutputStream non-Send)
- Accepte tous formats audio (I16/I24/I32/F32/F64) et convertit vers I16
- Support volume, arrêt gracieux, transitions gapless
- Exemples: play_audio.rs et play_with_resampling.rs
- Documentation: INSTALL_LIBSOXR.md mise à jour avec instructions ALSA
- Tests unitaires inclus, tous passent
- Replace BitDepth::from_audio_chunk() with match pattern
- Use get_frames() instead of stereo() method (API change)
- Use as_i32() instead of to_i32() for I24 conversion
Also successfully installed libsoxr locally without sudo:
- Downloaded libsoxr-dev and libsoxr0 via apt-get
- Extracted to ~/.local using dpkg -x
- Set PKG_CONFIG_PATH and LD_LIBRARY_PATH
- Compilation now succeeds with libsoxr
The implementation is now complete and compiles successfully.
- Add Node::logic_mut() method to allow post-construction configuration
of node logic before run() is called
- Fix FlacCacheSink to properly transfer playlist_handle_pending to
the inner logic using logic_mut()
- Resolves FIXME at flac_cache_sink.rs:656 about missing logic_mut()
This enables the playlist registration mechanism to work correctly:
1. User calls register_playlist() on FlacCacheSink
2. Handle is stored in playlist_handle_pending
3. During run(), handle is transferred to FlacCacheSinkLogic
4. Tracks are automatically added to playlist after caching