Length of first buffer less than 4400 call ov_open_callbacks will get OV_EBADHEADER
I write a wrapper for vorbisfile to decode ogg vorbis data. Because it is designed to decode data that is received from internet. So I write a reading callback for ov_open_callbacks. At first everything works. And then, I found a tricky problem :
IDecoder *pDecoder = new OggDecoder(); fstream inputFile("../test.ogg", ios_base::binary | ios_base::in);
const int SIZE = 4399; unsigned char *pBuffer = new unsigned char[SIZE]; size_t size = inputFile.readsome((char *)pBuffer, SIZE);
If I read a chunk of data that its length is less than 4400. And pass it to the wrapper. I will get a OV_EBADHEADER result returned by ov_open_callbacks.
Why? Is that a bug? Or just a feature ? Should I pass data to vorbisfile at last 4400 bytes?
Thanks.