PROBLEM: When streaming Radio Paradise blocks via HTTP using FFPlay, the buffer would cycle between 0KB and ~130KB approximately once per second, causing audio dropouts and interruptions. VLC worked fine, but FFPlay was sensitive to the burst transmission pattern. ROOT CAUSE: In StreamingFlacSink::broadcast_flac_stream(), the broadcaster was reading 8KB (8192 bytes) at a time from the FLAC encoder and sending the entire chunk at once to all HTTP clients. This created a "burst" pattern: - Read 8KB from encoder - Send entire 8KB chunk to all clients - Sleep if ahead of real-time pacing - Repeat FFPlay's buffer would fill rapidly with each 8KB burst, then drain completely before the next burst arrived, causing the observed cycling behavior. SOLUTION: Reduced the HTTP broadcast buffer size from 8KB to 512 bytes in StreamingFlacSink::broadcast_flac_stream(). This creates a much smoother, more continuous data flow that FFPlay can handle without buffer cycling. The 512-byte buffer size is: - Small enough to prevent burst transmission - Large enough to avoid excessive overhead - Sufficient for smooth streaming with real-time pacing CHANGES: - Restore stream_block.rs example from git history - Restore StreamingFlacSink and StreamingOggFlacSink from git history - Add "streaming" feature to pmoaudio-ext - Reduce broadcast buffer from 8192 to 512 bytes - Update pmoparadise to use pmoaudio-ext streaming feature TESTING: Test with FFPlay to verify smooth buffering: ```bash cargo run --example stream_block --features full -- 0 # In another terminal: ffplay http://localhost:8080/test/stream ``` Watch the "aq=" value in FFPlay output. It should now remain stable instead of cycling between 0KB and 130KB.
109 lines
3.2 KiB
TOML
109 lines
3.2 KiB
TOML
[package]
|
|
name = "pmoparadise"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
authors = ["PMOMusic Contributors"]
|
|
description = "Rust client for Radio Paradise streaming service"
|
|
license = "MIT OR Apache-2.0"
|
|
repository = "https://github.com/yourusername/pmomusic"
|
|
keywords = ["radio", "paradise", "streaming", "music", "flac"]
|
|
categories = ["multimedia", "api-bindings"]
|
|
|
|
[dependencies]
|
|
# HTTP client pour les requêtes à l'API Radio Paradise
|
|
reqwest = { version = "0.12", features = ["json", "stream"] }
|
|
|
|
# Gestion asynchrone
|
|
tokio = { version = "1", features = ["full"] }
|
|
|
|
# Sérialisation/Désérialisation JSON
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0"
|
|
serde_yaml = "0.9.33"
|
|
|
|
# Helpers
|
|
chrono = { version = "0.4", features = ["serde"] }
|
|
async-trait = "0.1"
|
|
sha2 = "0.10"
|
|
hex = "0.4"
|
|
tokio-util = { version = "0.7", features = ["io"] }
|
|
async-stream = "0.3"
|
|
rusqlite = { version = "0.37", features = ["bundled"] }
|
|
|
|
# Gestion des erreurs
|
|
thiserror = "2.0.17"
|
|
anyhow = "1.0"
|
|
|
|
# Streaming de bytes
|
|
bytes = "1.5"
|
|
futures = "0.3"
|
|
flacenc = "0.5.0"
|
|
|
|
# Logging
|
|
tracing = "0.1"
|
|
|
|
# URL manipulation
|
|
url = "2.5"
|
|
|
|
# Audio decoding/encoding
|
|
symphonia = { version = "0.5", features = ["all"] }
|
|
|
|
# Audio decoding - claxon for FLAC streaming
|
|
claxon = "0.4"
|
|
|
|
# pmoaudio-ext with playlist and streaming support (optional for examples)
|
|
pmoaudio-ext = { path = "../pmoaudio-ext", optional = true, features = ["playlist", "streaming"] }
|
|
|
|
# Common music source traits
|
|
pmosource = { path = "../pmosource" }
|
|
|
|
# Playlist management for FIFO support
|
|
pmoplaylist = { path = "../pmoplaylist" }
|
|
pmoconfig = { path = "../pmoconfig", optional = true }
|
|
|
|
# Cache support (OBLIGATOIRE - architecture refactorisée)
|
|
pmocovers = { path = "../pmocovers" }
|
|
pmoaudiocache = { path = "../pmoaudiocache" }
|
|
|
|
# pmoserver extension support
|
|
pmoserver = { path = "../pmoserver", optional = true }
|
|
utoipa = { version = "5.4.0", optional = true }
|
|
axum = { version = "0.8.4", optional = true }
|
|
|
|
# pmoaudio node support
|
|
pmoaudio = { path = "../pmoaudio", optional = true }
|
|
pmoflac = { path = "../pmoflac", optional = true }
|
|
pmometadata = { path = "../pmometadata", optional = true }
|
|
futures-util = { version = "0.3", optional = true }
|
|
|
|
[features]
|
|
default = ["metadata-only", "pmoconfig"]
|
|
# Mode métadonnées seules (pas de décodage FLAC)
|
|
metadata-only = []
|
|
# Active l'API REST pmoserver
|
|
pmoserver = ["dep:pmoserver", "dep:utoipa", "dep:axum", "server"]
|
|
# Feature pour activer le support serveur (cache registry)
|
|
server = ["pmosource/server", "pmoconfig"]
|
|
# Feature pour activer le support de pmoconfig
|
|
pmoconfig = ["dep:pmoconfig"]
|
|
# Feature cache (deprecated - toujours actif maintenant)
|
|
cache = []
|
|
# Active le support pmoaudio node (RadioParadiseStreamSource)
|
|
pmoaudio = ["dep:pmoaudio", "dep:pmoflac", "dep:pmometadata", "dep:futures-util"]
|
|
# Active le support complet avec playlist (pour les exemples avancés)
|
|
full = ["pmoaudio", "dep:pmoaudio-ext", "pmoconfig"]
|
|
|
|
[dev-dependencies]
|
|
# Tests
|
|
tokio-test = "0.4"
|
|
wiremock = "0.6"
|
|
# Pour les exemples avec logging
|
|
tracing-subscriber = "0.3"
|
|
# Pour l'exemple with_cache
|
|
pmocovers = { path = "../pmocovers" }
|
|
pmoaudiocache = { path = "../pmoaudiocache" }
|
|
|
|
[[example]]
|
|
name = "now_playing"
|
|
path = "examples/now_playing.rs"
|