Fix hang in the OneShotDecoder on undecodable FLAC data - #33
Open
mikicaivosevic wants to merge 1 commit into
Open
mikicaivosevic wants to merge 1 commit into
mikicaivosevic wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix hang in the OneShotDecoder on undecodable FLAC data. The decode loop in OneShotDecoder is driven by how much data is left in the buffer:
Whether that condition ever becomes
Falsedepends on libFLAC continuing to consume the buffer. When it stops, the loop never ends, and because this runs in the constructor, the caller never gets an object back to cancel or inspect.Drive the loop off the decoder state and stop as soon as libFLAC reports it can make no further progress. Let the read callback report end-of-stream when the buffer runs dry instead of waiting for data that can't arrive, keeping the wait for StreamDecoder, which is fed from another thread and does need it. Raise DecoderProcessException when the stream was aborted, matching what FileDecoder.process and StreamDecoder.finish already do, so a failed decode is reported rather than silently returning nothing.