Fix another infinite loop in mix_source_buffer(), case of uneven input#40
Merged
Merged
Conversation
This fixes another potential infinite loop, which may occur if remaining data in the input is less than `bufferframesize`, in such case `framesavail` resulted in 0, and src->offset never advanced. There are seemingly two options here: 1. Skip the remainder. 2. Use a local temp buffer, copy the remainder over and fill necessary remaining bytes with zeroes, then pass it into mix_buffer() too. I chose the first, as this ever affects only 1 last sample which, apparently, does not have all of the channels data filled, so this does not seem to be worth it.
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.
This fixes another potential infinite loop (first one was fixed by #31), which may occur if remaining data in the input is less than
bufferframesize. There are seemingly two options here:I chose the first, as this ever affects only 1 last sample which, apparently, does not have all of the channels data filled, so this does not seem to be worth it.
On a separate note, I suspect that instead of these workarounds, mojoAL could fix the buffer length in alBufferData, clamping it to the multiple of framesize. But I dont know the program too well, so idk if adjusting buffer's "length" value in this case may lead to any bad consequences.