[vorbis] Streaming audio to the waveout device

Agustin Cordes acordes at elinpar.com
Fri Oct 17 16:08:11 PDT 2003



 >Hi, I don't understand the problem you are describing. If you are 
decoding
 > audio data with vorbisfile and sending it to the waveout device, then 
I don't
 > see how ov_instant_bitrate() would help you. ov_instant_bitrate() 
will just
 > estimate the bitrate since the last time the function was called. I 
don't see
 > how this information would help fix audio problems.

 >However, other possibilities that might cause intermittent garbled 
output:

 >* ov_read() frequently returns fewer PCM samples than you tell it to. 
This is
 > not a bug, but rather by design. (It stops decoding when you get to 
the end of
 > the current Vorbis packet. The next call will decode another packet.) 
Make
 > sure you are checking the return value from ov_read() to see how much 
 >audio was
 > written.

 >* Buffering might also be a problem. A simple, single-threaded read/write
 > application can sometimes get into trouble if the audio playback 
device runs
 > out of audio to play while the program is blocked waiting for I/O 
(and thus not
 > decoding more audio). The fix here is to redesign your application, 
so you
 > probably want to rule out all other bugs before considering this.

 >Can you describe in more detail what the garbled audio sounds like? 
Are their
 >gaps? Stuttering? Noise?

The reason I mentioned the bitrate was because of this comment on the 
official decoding example:

/* we don't bother dealing with sample rate changes, etc, but you'll 
have to*/

But now that you explained what ov_instant_bitrate() I understand I 
shouldn't bother with it. About the things you mention:

* I'm not checking the ov_read() return value. In fact, I'm using a 
fixed value for the packets I stream to the waveout device, but it seems 
their size may vary. I will check this out.

* I'm pretty sure I'm not running out of buffer. I'm running traces to 
see how much buffer I've left and there's plenty of it. As a matter of 
fact, I'm using a multi-threaded application with double-buffering (I 
guess it's not _so_ simple!).

The garbled audio sounds very much like gaps. It looks like the 
ov_read() ret value might be it. The thing that puzzles me is that if I 
encode a file with CBR it works great but when I encode the same file 
with VBR it doesn't.

Thanks!

--- >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 at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis mailing list