[PERF] MP3 seeking gets progressively slower in long files with MiniAudio-backed decoder.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- csharp
- Ambito
- performance
Direzione di ricerca
Riproduci i tempi con l’esempio di MP3 lungo e ricercabile, quindi traccia StreamDataProvider.Seek(...) attraverso MiniAudioDecoder.Seek(...) fino a ma_decoder_seek_to_pcm_frame(...). Confronta il percorso MiniAudio integrato con FFMPEG, se disponibile. Il lavoro è completo quando le ricerche successive non mostrano più il rallentamento progressivo segnalato, con misurazioni che coprano le posizioni di destinazione elencate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
1. Describe the Performance Issue
Seeking within long MP3 files appears to become progressively slower as the target position gets later in the file when using SoundFlow's built-in MiniAudio MP3 decoder path. I have not verified whether the issue exists when using the FFMPEG module.
2. Area of the Library Affected
The suspected culprit is:
SoundFlow’s built-in MiniAudio-backed MP3 decoder seek path, specifically:
StreamDataProvider.Seek(...)
→ MiniAudioDecoder.Seek(...)
→ ma_decoder_seek_to_pcm_frame(...)
3. Scenario Causing Slowness
Seeking within long MP3 files appears to become progressively slower as the target position gets later in the file when using SoundFlow's built-in MiniAudio MP3 decoder path.
In my app, Auzi, playback is using SoundFlow 1.4.1. Auzi delegates seeking directly to SoundFlow, and the slowdown appears to happen inside the MiniAudio decoder seek call rather than in the app's own playback layer.
4. Expected Performance
Seeking to an arbitrary position in a long MP3 should be roughly bounded and should not scale linearly with the target timestamp, at least when the input stream is seekable.
5. Actual Performance
For a long MP3 file, seeks near the beginning complete quickly, but seeks later in the file take much longer.
Example timings from the same file:
| Target position | Seek time |
|---|---|
| 00:00:30 | 21 ms |
| 00:10:00 | 391 ms |
| 00:30:00 | 809 ms |
| 01:00:00 | 1210 ms |
| 02:00:00 | 2421 ms |
This makes timeline scrubbing feel increasingly delayed on long MP3s.
6. Minimal Reproducible Example (MRE) (Highly Recommended)
A minimal repro should be possible with a long seekable MP3 file:
using System.Diagnostics;
using SoundFlow.Backends.MiniAudio;
using SoundFlow.Providers;
using SoundFlow.Structs;
using var engine = new MiniAudioEngine();
using var stream = File.OpenRead(args[0]);
using var provider = new StreamDataProvider(engine, AudioFormat.DvdHq, stream);
var formatInfo =
provider.FormatInfo
?? throw new InvalidOperationException(
"Stream data provider did not report audio format information."
);
foreach (var seconds in new[] { 30, 600, 1800, 3600, 7200 })
{
var sampleOffset = checked(seconds * provider.SampleRate * formatInfo.ChannelCount);
var sw = Stopwatch.StartNew();
provider.Seek(sampleOffset);
sw.Stop();
Console.WriteLine($"{TimeSpan.FromSeconds(seconds)}: {sw.ElapsedMilliseconds} ms");
}
7. Profiling Data (if available)
SoundFlow Version
1.4.1
.NET Version
.NET 10
Operating System
Windows 11, macOS Tahoe, Ubuntu 25.10
Architecture
Windows and Ubuntu (x64), macOS (ARM64)
Audio Backend Used (if known)
MiniAudioEngine usage varies by OS.
Specific Audio Hardware (if relevant)
No response
Audio Buffer Size / Sample Rate
No response
9. Additional Context
No response
Requirements Checklist
- I have searched the existing issues to ensure this performance issue has not already been reported.
- I have provided a clear description of the issue and the scenario.
- I have included performance metrics if possible.
- I have considered providing an MRE.
- I have completed the environment information.
- Lingua principale
- C#
- Stelle
- 512
- Fork
- 56
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di LSXPrime/SoundFlow
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
[BUG] WebRtcApmModifier: AEC silently does nothing - far-end (reverse) stream is never fed to APM Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
question
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Tutte le issue di LSXPrime/SoundFlow
Issue simili
-
effort:S P3 refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
nightscout/nocturne#1532 ·
-
core dependencies
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
C#/.NET Roslyn LSP Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Suspicious code fragments Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
DotNetNext/SqlSugar#1458 ·