-
Notifications
You must be signed in to change notification settings - Fork 17
Fix crash in resampler #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If this is reproducible it needs fixing but I don't want to accept the PR just yet because I don't know if it fixes the root of the problem. |
A comment on another issues:
|
As mentioned in the issue and seen in the screenshot, the buffer is extremely small. However, the // There are 3 valid return pattterns of the Stream method:
//
// 1. n == len(samples) && ok
//
// Stream streamed all of the requested samples. Cases 1, 2 and 3 may occur in the following
// calls.
//
// 2. 0 < n && n < len(samples) && ok
//
// Stream streamed n samples and drained the Streamer. Only case 3 may occur in the
// following calls.
//
// 3. n == 0 && !ok
//
// The Streamer is drained and no more samples will come. If Err returns a non-nil error, only
// this case is valid. Only this case may occur in the following calls.
Stream(samples [][2]float64) (n int, ok bool) If the source streamer returns Assuming you didn't write any custom streamers, we need to check all existing streamers to see if they implement this behavior properly to fix this problem... |
Relevant bug in |
The |
I noticed that when using small buffers and rapidly changing ratio, the resampler tries to access samples outside of the old buffer
buf1
, causing a crash.My solution is to simply use the oldest sample we have. Not sure if this is good enough, but works for me.
Original issue: faiface/beep#152
The text was updated successfully, but these errors were encountered: