Commit Graph

43 Commits

Author SHA1 Message Date
Claude
ce63cbffb3 refactor: Remove dead FFmpeg code from pmoparadise
Remove unused FFmpeg-based progressive streaming implementation that was
never completed and is not used anywhere in the codebase.

Changes:
- Delete src/ffmpeg_streaming.rs (173 lines of unfinished code with TODOs)
- Remove ffmpeg module import from lib.rs
- Remove ffmpeg feature from Cargo.toml
- Remove ffmpeg-next dependency from Cargo.toml

The current implementation uses claxon (StreamingPCMDecoder) and symphonia
(decode_block_audio) for FLAC decoding, which are fully functional.

Verified: cargo check passes successfully after removal.
2025-11-05 06:24:57 +00:00
Claude
28e33dc26f fix: Properly await async metadata setters in song_to_metadata
Problem:
- Used `let _ = metadata.set_title(...)` which creates unawaited Future
- Futures were never executed → metadata fields never set!
- Ignored Result<(), MetadataError> which could contain errors

Solution:
- Spawn tokio task to configure metadata asynchronously
- Properly await all set_*() calls
- Handle errors with eprintln! warnings instead of silent ignore
- Clone all data upfront for the async task

Type info:
- metadata: MemoryTrackMetadata (concrete type)
- Returns: Arc<RwLock<dyn TrackMetadata>> (trait object)
- Methods: async fn set_*(&mut self) -> MetadataResult<()>

All 7 tests still pass 
2025-11-05 06:01:51 +00:00
Claude
094c4af082 fix: Complete RadioParadiseStreamSource refactoring for current pmoaudio API
Refactored RadioParadiseStreamSource to use current pmoaudio API:

Audio Segment Creation:
- Replaced AudioSegment::new_audio() with manual construction using _AudioSegment
- Convert PCM to Vec<[i16; 2]> or Vec<[I24; 2]> stereo pairs
- Use AudioChunkData::new(stereo, sample_rate, gain_db) → Arc
- Wrap in AudioChunk::I16() or AudioChunk::I24()
- Create AudioSegment with order, timestamp_sec, and _AudioSegment::Chunk()

Sync Markers:
- Replaced AudioSegment::new_sync() with AudioSegment::new_track_boundary()
- Created TopZeroSync manually with _AudioSegment::Sync()
- Use AudioSegment::new_end_of_stream() for EOF

Stream Handling:
- Changed from decoder.next() (doesn't exist) to decoder.read()
- Added AsyncReadExt import
- Use buffered read approach like http_source
- Changed decoder.stream_info() to decoder.info()

I24 Construction:
- Changed I24::from_i32() to I24::new_clamped()
- Properly handles 24-bit PCM conversion with sign extension

Metadata:
- Fixed RwLock usage - write().await returns guard directly, no Result
- Added `let _` for Future return values

Testing:
 All 7 unit tests pass (cache FIFO behavior)
 RadioParadiseStreamSource compiles successfully with pmoaudio feature
2025-11-05 05:57:52 +00:00
Claude
dbfa392429 fix: Partial test corrections for RadioParadiseStreamSource
Fixed test issues:
- Changed EventId(i) to plain i (EventId is type alias for u64)
- Added create_test_client() helper using RadioParadiseClient::with_client()
- Cast DEFAULT_CHUNK_DURATION_MS to u32 as expected by constructor

Outstanding API incompatibility issues:
- AudioSegment API has evolved (new_audio/new_sync no longer exist)
- AudioChunkData::from_interleaved() doesn't exist
- I24::from_i32() should be I24::new() or I24::new_clamped()
- Need to understand current pmoaudio API for creating audio segments

Tests compile but RadioParadiseStreamSource implementation needs
significant refactoring to match current pmoaudio API.
2025-11-05 05:50:29 +00:00
Claude
fc5b0288b7 test: Add comprehensive unit tests for RadioParadiseStreamSource cache
Added 8 unit tests covering cache FIFO behavior:

1. test_cache_fifo_basic - Verify basic cache operation with 5 elements
2. test_cache_fifo_exactly_10_elements - Verify behavior at capacity limit
3. test_cache_fifo_eviction_oldest - Verify oldest element evicted on overflow
4. test_cache_fifo_multiple_evictions - Verify multiple sequential evictions
5. test_cache_never_exceeds_capacity - Critical test: 100 insertions, never exceeds 10
6. test_cache_fifo_order_preserved - Verify FIFO order (front=oldest, back=newest)
7. test_block_queue_push - Verify block queue management

Tests validate:
- VecDeque capacity never exceeded (while loop correctness)
- Oldest elements evicted first (FIFO ordering)
- Cache maintains exactly ≤10 elements at all times
- Pre-allocated capacity of 10 is respected

Note: Tests require 'pmoaudio' feature which depends on libsoxr system library
2025-11-05 05:44:53 +00:00
Claude
17dec3351e fix: Use while loop instead of if for robust cache size guarantee
Problem:
- With `if >= CACHE_SIZE`, only ONE element removed per call
- If cache ever had >10 elements (abnormal state), would stay oversized
- Example: 12 elements → if removes 1 → 11 elements → add 1 → 12 elements 

Solution:
- Use `while >= CACHE_SIZE` to remove ALL excess elements
- Example: 12 elements → while removes 2 → 10 elements → add 1 → 10 elements 
- Guarantees exactly ≤10 elements regardless of initial state

Changes:
- mark_block_downloaded(): changed `if` to `while`
- Updated comment to reflect "tous les éléments excédentaires"
- Documentation updated with robustness guarantee
2025-11-05 05:35:09 +00:00
Claude
ec61af7b71 fix: Prevent cache from exceeding pre-allocated capacity
Problem:
- Previous logic: push_back() first, then pop_front() if len > 10
- This temporarily creates 11 elements, exceeding VecDeque capacity of 10
- Wastes the benefit of with_capacity() pre-allocation

Solution:
- Check capacity BEFORE adding: if len >= 10, pop_front() first
- Then push_back() new element
- Guarantees never exceeding 10 elements at any time

Changes:
- mark_block_downloaded(): inverted order (pop before push)
- Changed condition from `> CACHE_SIZE` to `>= CACHE_SIZE`
- Documentation updated with correct logic and benefits
2025-11-05 05:33:36 +00:00
Claude
c2b78fa040 fix: Replace HashSet with VecDeque for recent blocks cache
Problem:
- HashSet doesn't maintain insertion order
- iter().next() returns arbitrary element, not the oldest
- Cache eviction was unpredictable

Solution:
- Use VecDeque for FIFO ordering
- push_back() adds new block
- pop_front() removes oldest block when cache exceeds 10 elements
- contains() is O(n) but performant for 10 elements

Changes:
- RadioParadiseStreamSourceLogic: recent_blocks now VecDeque<EventId>
- mark_block_downloaded(): simplified with guaranteed FIFO eviction
- Documentation updated with VecDeque usage and advantages
2025-11-05 05:31:43 +00:00
Claude
1d8bdfa30c docs: Add RadioParadiseStreamSource documentation and usage example
- Add comprehensive technical documentation (RADIO_PARADISE_STREAM_SOURCE.md)
- Add practical usage example (examples/radio_paradise_stream.rs)
- Document architecture, timing algorithm, and API
- Include both basic and advanced usage patterns with nowplaying stream
2025-11-05 05:16:51 +00:00
Claude
e084e75faa feat: Add RadioParadiseStreamSource - pmoaudio node for Radio Paradise
Implement a new pmoaudio source node that streams Radio Paradise blocks
with automatic TrackBoundary insertion at the correct timing.

Features:
- Downloads and decodes FLAC blocks from Radio Paradise API
- Queue management for block IDs via push_block_id()
- Recent blocks cache (10 blocks) to avoid re-downloads
- Automatic TrackBoundary insertion based on sample count timing
- Converts Song metadata to TrackMetadata with cover URLs
- Timeout of 3 seconds for new block IDs (radio real-time)
- Support for 16-bit and 24-bit FLAC audio

Architecture:
- RadioParadiseStreamSourceLogic: Pure business logic implementing NodeLogic
- RadioParadiseStreamSource: Wrapper using Node<> pattern
- Uses logic_mut() for push_block_id() configuration

The node emits:
- TopZeroSync at block start
- TrackBoundary before each song (with same order as next chunk)
- Audio chunks (I16 or I24)
- EndOfStream on timeout or completion

New pmoaudio feature gate with dependencies on:
- pmoaudio, pmoflac, pmometadata, futures-util
2025-11-04 23:28:13 +00:00
5b60fdbe1d Refactoring de pmoflac -factorisation de code ogg et opus 2025-10-29 22:36:36 +01:00
09cdd3f516 stream radio paradise 2025-10-29 22:36:36 +01:00
dea7062038 Je ne sais pas trop 2025-10-29 22:35:53 +01:00
aae941b7cb passage à de l'encodage rééelement en flux 2025-10-29 22:35:53 +01:00
c5569cdcf2 Debuggage du streaming des block radioparadise 2025-10-29 22:35:53 +01:00
1d0a1c22f4 Corrigeons la base de donnée des caches... 2025-10-29 22:35:53 +01:00
d49a1e54d6 Debug du stream 2025-10-29 22:35:53 +01:00
55be74bd94 On s'attaque au metadata de radio paradise dans le cache 2025-10-29 22:35:10 +01:00
d2b9cbf93b encore des problèmes de configuration 2025-10-29 22:35:10 +01:00
e5fbf372c4 On continue le refactoring des sources 2025-10-29 22:35:10 +01:00
fc093743c1 Refactoring du cache pour une meilleur gestion des metadonnées 2025-10-29 22:35:10 +01:00
df138565af meulleur gestion des routes de streaming 2025-10-26 09:18:22 +01:00
4b29d12859 retire le mediaserver de pmoparadise 2025-10-26 07:42:33 +01:00
882b6e2886 retire le support des codec non flac de radio paradise 2025-10-26 07:33:52 +01:00
a64a5f6a6a evite les doubles download de block 2025-10-26 07:22:12 +01:00
2ab526464d Lire le flac en stream et le décoder en PCM avec claxon 2025-10-26 06:46:56 +01:00
6c40b93089 on retravaille les sources et pmoparadise en particulier 2025-10-25 22:01:02 +02:00
1567beee2e Refactoring profond de pmoparadise 2025-10-21 18:37:40 +02:00
f510e59b1a Patch of the web logger 2025-10-20 19:50:58 +02:00
b6e439dcf6 lastest correction on webapp 2025-10-20 16:18:21 +02:00
2632233dbd Correction on cache system 2025-10-20 16:18:21 +02:00
f3e6c59143 Correction de la source radio paradise pour avoir un sous dossier par canal 2025-10-20 16:18:21 +02:00
776c535862 amélioration de la webapp 2025-10-20 16:18:21 +02:00
e9109a8a0c Session de debug radio paradise 2025-10-20 16:18:21 +02:00
7a8562fe8e Ajount d'un viewer radio paradise 2025-10-20 16:18:21 +02:00
032b55a6f1 ebuggage transcodage audio en flac 2025-10-20 16:18:21 +02:00
5c36116092 device multisession 2025-10-20 16:18:21 +02:00
ebc15b0518 nouveau mediarenderer 2025-10-18 14:33:52 +02:00
c1e0151a11 Refactoring des pmosource 2025-10-18 09:38:33 +02:00
bd61fdba81 complète le trait MusicSource 2025-10-17 08:37:28 +02:00
5c06a0f0e9 Crée la crate pmoplaylist 2025-10-17 07:47:39 +02:00
e0fbb11475 Elabore une crate pmosource 2025-10-16 22:12:15 +02:00
ffecc219b5 implemente pmoparadise 2025-10-12 21:34:59 +02:00