Hi,guys<br>Hope you are doing well!<br>I am an ogg format starter, and I am implementing ogg audio streaming.<br>I meet some problems for streaming. <br><br>My application is as follows:<br>I send download request to server,and server sends the download ogg file to client side.<br>
when a certain amount of data is downloaded, and I start to play the ogg file by using a library.<br><br>I use juce c++ library which uses vorbisfile.c to read and write ogg format.<br><br>I updated the lengthInSamples of the ogg file to the size of ogg file.<br>
After certain chunk of data is downloaded,<br>ogg length in samples is initialized by <br><br> callbacks.read_func = &oggReadCallback;<br> callbacks.seek_func = &oggSeekCallback;<br> callbacks.close_func = &oggCloseCallback;<br>
callbacks.tell_func = &oggTellCallback;<br><br> const int err = ov_open_callbacks (input, &ovFile, 0, 0, callbacks);<br><br> lengthInSamples = (uint32) ov_pcm_total (&ovFile, -1);<br>input is the file stream.<br>
<br>The first chunk data is played excellent, however, after that , it gives me static noise.<br>I debugged the decoder, and it seems that the ogg pattern is not decoded right in this case.<br>In vorbisfile.c<br>static long _get_data(OggVorbis_File *vf){<br>
....<br> long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource); <br>..<br>}<br><br>The buffer should hold the header feild "oggs", however, it did not.<br>I think the problem is vf->seekable = 1.<br>
if the vf->seekable = 1, is it the problem for streaming? How can I achieve ogg streaming?<br><br>Thank you in advance!<br><br>Leon<br>