-
Notifications
You must be signed in to change notification settings - Fork 451
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
WaveWriter - WaveHeader is not fully valid. #12
Comments
Also confirmed for 1_1. |
Did you dispose the WaveWriter? |
Yes, I'm using it in a using-block. Sorry for late reply. |
I am going to have a look at it. But you could take a look at the cscore decoder. The cscore decoder should be able to read the datasize. |
Do you mean the WaveFileReader? If yes it simply ignores the data length. |
Ok, I am going to debug it today or in the next few days. But by just reading the code, I can't find any mistake in the WaveWriter class. Every Write operation increments the _dataLength correctly. And the Dispose method calls the WriteHeader method which writes down the _dataLength at the correct position. |
You also writing the header in the ctor https://github.com/filoe/cscore/blob/master/CSCore/Codecs/WAV/WaveWriter.cs#L54 |
Of course, the line you mentioned reserves some space for the header inside of the stream. But the content of the header gets written by the WriteHeader method which gets called in the Dispose method: https://github.com/filoe/cscore/blob/master/CSCore/Codecs/WAV/WaveWriter.cs#L265 |
Yes but line 60 is still not necessary as far as I can see. But thats not the problem just a side note 🍡 |
You're right, line 60 or the loop at line 54 would not be necessary. |
Also you could seek the stream by 44 bytes so you don't need to write 0 44 times. Don't know if this would bring a bit more performance. |
Still waiting on any updates... |
Since this issue could not be reproduced, and @ThuCommix did not respond for months... I would guess I can close this. |
https://github.com/filoe/cscore/blob/master/CSCore/Codecs/WAV/WaveWriter.cs#L249
If I read the WaveHeader the DataSize is always zero.
So I guess _dataLength is 0 at the time of writing the header? Most playback devices ignore the wrong data length flag, but some (mine) need this flag for validity checks.
The text was updated successfully, but these errors were encountered: