When I am using vorbisfile on a disk file, ov_read does not always (in fact - most of the time) read the number of bytes I request. It doesn't seem to be dependent on the number I ask for, and the ratio between what I request and what is read varies. Can somebody tell me what's going on here? TIA Lance --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
#if Lance> When I am using vorbisfile on a disk file, ov_read does not always (in > fact - most of the time) read the number of bytes I request. > It doesn't seem to be dependent on the number I ask for, and the ratio > between what I request and what is read varies. > Can somebody tell me what's going on here?On a multiprocessing system, another task may be requesting resources such as the disks at the same time as yours. Unless you're running as a realtime process, the kernel will, at some point, stop your process running, and give time to another. This means that you don't get all the bytes you requested during a single read() operation. Just keep asking until you have enough. Rik --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
At 04:26 PM 3/7/01 +1300, you wrote:>When I am using vorbisfile on a disk file, ov_read does not always (in >fact - most of the time) read the number of bytes I request. >It doesn't seem to be dependent on the number I ask for, and the ratio >between what I request and what is read varies. >Can somebody tell me what's going on here?It's behaving as intended (and as documented). It's better to think of that number as being 'size of buffer' rather than 'how much data I want' - vorbisfile will then fill some part of the buffer, guaranteed not to be more than the amount of space present. It won't typically fill the entire buffer, though. The right thing to do if you need to fill the entire buffer is to loop over the ov_read() call until your buffer is full. In many cases, though, this isn't (directly) neccesary. Michael --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.