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
Wrong number of frames in pipe-write mode #77
Comments
This is not a libsndfile problem, this is a C problem. If you ran your program under Valgrind (which I highly recommand) then Valgrind would complain that sfinfo struct has un-initialized values. To understand what that is, you should google "C automatic variable un-initialized". The fix is to add:
before the line
Does that make sense? |
Thanks for the quick reply, but I'm sorry to say that it doesn't really make sense to me. I'd expect libsndfile to set Anyway, I had tried already to set I had a quick look in the source: In So what's the intended behavior? Should |
What should libsndfile set it to? The intended behaviour is that it works correctly. You have a value that you think in anomolous. I still don't see any big here. If you want me to look at this further I need a repeatable test case that displays a problem. Feel free to hack the file |
To the number of available frames, I guess? In case of a freshly opened file in
It's nothing big.
I played around a bit but I don't know how to check if some variable has a value of But what I did is add a line in
This prints some interesting numbers:
So I guess Do you really not find that strange? |
How is it supposed to figure that out? While writing a file, the number of frames written cannot be determined until the file is closed, regardless of whether you are writing to a file or a pipe.
At this point, the value of
For undefined behaviour, not even nasal daemons (http://www.catb.org/jargon/html/N/nasal-demons.html) would be considered strange. |
That's easy. It's always zero. As I understand it,
Sure. No problem there. The number of frames when closing the file can only be determined when closing the file. Following your argument, the same problem would occur in
But why does it then work as expected with "normal" files and does yield a strange value only with pipes?
OK, if you want to make libsndfile's interface more complicated than necessary, I can live with that (Thanks for the nasal daemons link, BTW). But then you should mention it in the documentation. Anyway, thanks very much for your responses. |
Thats an incorrect assumption. That field is undefined when opening a file in
No it wouldn't. In
The code paths are different for "normal" files. Anyway, I've messed with the tests a little and found that a trival rearrangement of the code in the library can result in |
When opening a file in SFM_WRITE mode where the output is a pipe, the sfinfo.frames value was coming back with strange values. The fix is simply to make sure it get set to zero. Closes: #77
Fixed in commit 19e12f5. |
Great, thanks! |
When opening a named FIFO for writing, I'd expect the number of frames to be reported as
0
(like when opening a normal file inSFM_WRITE
mode).When I tried it, however,
frames
was-13
.This is some code to reproduce it:
Before starting this, a named FIFO has to be created and something has to read from it, e.g. like this:
Is the negative value intentional?
Does it mean something?
The text was updated successfully, but these errors were encountered: