fix: SymphoniaDecoder::current_span_length now returns None instead of Some(0)#833
fix: SymphoniaDecoder::current_span_length now returns None instead of Some(0)#833jgraef wants to merge 2 commits intoRustAudio:masterfrom
SymphoniaDecoder::current_span_length now returns None instead of Some(0)#833Conversation
|
Thank you for the PR to go with your issue 🚀 While this fix works, I rather suggest that in Also if you would add a changelog entry? |
|
I briefly thought about this solution too, but saw an issue with it and wanted a quick fix. Checking again, I think I don't see any issues with this solution anymore. So after we get a sample in This would almost make the loop before we get the sample unnecessary, except when the decoder is initialized with an empty buffer (and maybe other edge-cases I'm unaware of). Aha! I remember the issue I saw. Your suggestion would not fix the issue, since it would still return the incorrect I can work on this, but I would first need to read and understand the code more thoroughly. |
|
I see your point. A complete fix is in #786 but was rejected. The issue with returning |
|
Did you link the right PR? It seems unrelated.
Imho it's better than returning |
Corrected: #786 |
ae8529d to
51acc39
Compare
|
Having 2 separate loops that decode the next relevant packet is the problem here. It leads to the bug #775 and I think I spotted another one. Bug #775 is now fixed by properly skipping to the next non-empty frame in the loop in The other bug: I'd like to merge both loops into a single function/method, but they have slightly different error handling. |
|
I also wanted to write a test for this specific bug. Does rodio have an established way of generating small audio files for this? |
|
We love tests, but don't have any standard way of generating audio files. |
Fixes #832
My first idea was to make
current_span_lendecode a new packet if the buffer is empty, butcurrent_span_lenonly gets an immutable borrow ofselfand thus can't do that. As a fix I just added a check that returnsNoneinstead ofSome(0).After I applied this patch the music started playing 🎶