Skip to content
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

GetAvgSamplesAsync reads beyond data chunk #86

Closed
nightman94 opened this issue Jun 29, 2023 · 1 comment
Closed

GetAvgSamplesAsync reads beyond data chunk #86

nightman94 opened this issue Jun 29, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@nightman94
Copy link

The GetAvgSamples() method reads the number of samples from the stream based on the value in SamplesCount. However the async version of that method reads until the end of the stream without considering SamplesCount. If there are other chunks after the data chunk this leads to an out of bounds exception.
A workaround right now is processor.ProcessAsync(new WaveParser(fileStream).GetAvgSamples())), effectively reading sync, but still processing async.

@sandrohanea sandrohanea added the bug Something isn't working label Jun 30, 2023
@sandrohanea
Copy link
Owner

Hello @nightman94 ,
I checked the code and indeed it seems like a bug in the different implementations of GetAvgSamples (Async vs Non-Async).
Will fix it asap and unify these methods, similar to InitializeCore in https://github.com/sandrohanea/whisper.net/blob/main/Whisper.net/Wave/WaveParser.cs

@sandrohanea sandrohanea self-assigned this Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants