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
missing samples when doing a partial read of ogg file from index till the end of file #643
Comments
Hi @krisfed. Can you help us to find buggy commit with |
Sure thing! Seems like this is the culprit:
Makes sense if something is going awry with seeking.. |
@arthurt, can you look at this? |
Looking |
If this helps, one thing I noticed is that the point when the start index becomes "bad" seems to depend on the sample rate of the file. For the above example, for the sample rate of 44100, the starting indices that cause problems are >= 88201. For sample rate of 22050, "bad" starting indices are >= 44101. So it would seem that problematic indices begin from 2*(sample rate) + 1 . I did not look at the source code to see why it might be, but just in case this is useful. |
This would suggest that it is the bisection seek search code which is causing an issue. For a seek that is less than 2 seconds from the last read position, the seek is performed by reading and throwing away decoded samples instead of searching. (The negative condition in the following code snippit.)
I guess this wasn't picked up by the test suite because it must not test seeks of more than 2 seconds. |
I don't think there is a fault with the bisection search code in It all acts as if there is an unaccounted for decoder delay. The first 20ms or thereabouts of samples after Still investigating. |
Thanks for explaination. |
As an update, the issue is caused by not taking into account the full-lapped nature of vorbis blocks. When seeking to a page the sample offset in the file needs to be calculated from the page's granule position. The code in master currently over-counts how many samples are in a page after a seek. See https://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-230001.3.2 about window shapes. I'll have a PR up soon. |
ping @arthurt |
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
The fix merged in #709 should have addressed this issue. The provided test-case works correctly now. GitHub auto-closes the ticket on merge. If you are still experiencing issues with seeking in Ogg/Vorbis, please let us know. |
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
libsndfile/libsndfile#643 was not fixed in libsndfile 1.0.31.
Hi all,
We are in the process of upgrading from 1.0.28 to 1.0.30, and we noticed this issue in the new release.
Looks like it happens when you seek to a start index that is >=88201 before reading. The read data seems to match the data at end of the file, but some samples right after the start index are missing. The number of missing samples seems to always be a power of two.
Here is simple reproduction code with an example:
For this example, the total number of samples is 396519. If we start at 389999 and try to read a framesize (65536) we should get all the remaining samples in the file - 6520. But with 1.0.30 release I only get 5496 (missing 1024 samples).
Here is the output of the above repro code for 1.0.28:
And for 1.0.30:
(both ran on macOS 10.15.3, but we see the issue on Windows too)
The file used in the example is attached - mytest.zip. It was randomly generated, but I see this issue on other .ogg files that are long enough. Here is the snd-info output:
Does this look familiar to anyone? Is this a bug introduced in 1.0.29 or 1.0.30, or is there something else going on here?
Thanks!
The text was updated successfully, but these errors were encountered: