Jim Buschman
2007-Dec-13 17:26 UTC
[Vorbis-dev] Help recording from PCM stream and silence.
I need it to be able to take a stream of PCM data and encode it. Right now it works if I am recording from a source (i.e. microphone or with "what you hear") but when I try to use another API (Team Speak) to capture the PCM data it doesn't seem to be encoding correctly. (I know the PCM data is correct. I am able to use it to create a wav file.) I'm also having a problem with recording silence and playing back silence correctly. It sounds correct, but when you look at the time stamps, the silence doesn't show up. If you record 10 minutes of noise and 1 minute of silence the total time will show as 10 minutes but it will play for 11. I have a feeling that my first problem might be caused by my second but I'm not really sure. I've tried to explain this the best I could but fear that it might not make much sense. Please let me know if I need to make anything more clearly or if you need more information. If you need to see code, please try and let me know what you need to see because I can't really post all of it. -- ~Jim
Ralph Giles
2007-Dec-13 17:36 UTC
[Vorbis-dev] Help recording from PCM stream and silence.
Without seeing code, I'd suggest making sure you're flushing *all* the pages out of the ogg_stream and writing them out. Silence compresses well, so if you don't call 'ogg_stream_flush' you may not see a page for some time. Note that for streamability you should always call ogg_stream_flush if ogg_stream_pageout hasn't returned a page in more than a couple seconds of input data. libogg isn't smart enough to handle this for you, and it can cause underruns when streaming. -r