OGG files clipping issue



I am facing a problem with OGG Vorbis audio writer of juce 1_39
I create an juce::AudioSource with an input wav file(44100 kz,2 channel,16 bit) and read samples
from it at intervals of 8192 bytes using AudioSource::getNextAudioBlock() function.

As i get the samples I write it into an OGG file using the write function of
juce::AudioFormatWriter(initialized with OGGVorbis Audio format)

I find that the duration of the rendered out audio is clipped by (10-50)% ,
the percentage varying for different input wav files

I have also checked by increasing the byte interval,i.e (81922,81923 bytes) but this doesnt solve my problem

On tracing into the problem i found that the ogg_stream_pageout used in the write function of OGGWriter fails randomly and nothing is written into the output stream that time

Could you help me with this issue and give me a solution

Thanks and Regards


If it’s an ogg bug, I’m afraid I’ve no idea.

But are you sure you’re not doing something daft like forgetting to close/delete the output stream when you’re finished? That’d obviously lose some data from the end of the file.