sorry, no webchat, is a videoconference program. And I'm using UDP as you can read down on the mail.<br>The problem is that speex packages alone work great, but to split speex/theora packages on the arrive I need to use some kind of container, and I'm trying ogg.
<br><br><div><span class="gmail_quote">On 8/7/06, <b class="gmail_sendername">Jean-Marc Valin</b> <<a href="mailto:jean-marc.valin@usherbrooke.ca">jean-marc.valin@usherbrooke.ca</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If by webchat you mean anything interactive, then I can already tell you<br>what the problem is. TCP+Ogg. For anything real-time, you want UDP/RTP<br>without Ogg. Also, you need to take into account the fact that computers
<br>do *not* have accurate clock and their soundcards drift. None of these<br>problems are fatal, but you need to take that into account in the<br>design.<br><br> Jean-Marc<br><br>On Mon, 2006-08-07 at 02:53 +0200, Jere Gmail wrote:
<br>> I'm currently working on a speex + theora webchat.<br>> I have both working alone, but to make them work together and to know<br>> where the package goes, I'm trying to use ogg packages.<br>> With theora there has been no problem, but with speex I can't make it
<br>> work. The problem is that for a second it works great, but then it<br>> begings to gain lag, and in a little time it has 5-10 lag seconds<br>> (into the same machine, working on loopback). Currently I'm packaging
<br>> 4 frames per package (FRAMES_PACKET=4).<br>> Any help will be greatly appreciated.<br>><br>><br>> Into the encoder I have this code:<br>><br>> speex_bits_reset(&enc_bits);<br>> for(int i=0;i<FRAMES_PACKET;i++)
<br>> {<br>> int nb_samples;<br>> //Here I get the microphone data.<br>> while((nb_samples=Check_Mic(Mic_data))==0);<br>> speex_encode_int(enc_state, Mic_data, &enc_bits);<br>><br>> total_samples += nb_samples;
<br>> speex_bits_insert_terminator(&enc_bits);<br>><br>> //The time stamp<br>> if(i==0)<br>> ((int*)packet)[0]=total_samples;<br>> }<br>> int nbBytes = speex_bits_write(&enc_bits, packet+4, 2000);
<br>> tam=nbBytes+4;<br>><br>> //Now the ogg package<br>> op.packet = (unsigned char *)packet;<br>> op.bytes = nbBytes+4;<br>> op.b_o_s = 0;<br>> op.packetno = packet_id;<br>> packet_id++;<br>><br>
> ogg_stream_packetin(&os, &op);<br>> ogg_stream_flush(&os, &audio_page);<br>><br>> return audio_page;<br>> }<br>><br>> As for the decoder I have this.<br>><br>> //Incoming data from udp is on buffer
<br>> char *buffer=ogg_sync_buffer(&oy,4096);<br>> memcpy(buffer,buff,len);<br>> ogg_sync_wrote(&oy,len);<br>> while(ogg_sync_pageout(&oy,&audio_page)>0)<br>> {<br>> if (stream_init == 0)
<br>> {<br>> ogg_stream_init(&os, ogg_page_serialno(&audio_page));<br>> stream_init = 1;<br>> }<br>> queue_page(&audio_page);<br>><br>> while(ogg_stream_packetout(&os,&op)>0)
<br>> {<br>> int b;<br>> ogg_stream_pagein(&os, &audio_page);<br>> int len=(audio_page.body_len-4)/FRAMES_PACKET;<br>><br>> char *datos=(char*)op.packet;<br>> char m[100];
<br>> sprintf(m,"paq %d", op.packetno);<br>> System::Console::WriteLine(gcnew String(m));<br>><br>> int t=((int *)datos)[0];<br>> for(int i=0;i<FRAMES_PACKET;i++)
<br>> speex_jitter_put(&jitter,(datos+4)+len*i,len,t<br>> +FRAME_SIZE*i);<br>> }<br>> }<br>><br>><br>> --<br>> <a href="http://www.apple.com">http://www.apple.com</a><br>> A veces me da por ahi. Otras como que no.
<br>> _______________________________________________<br>> Speex-dev mailing list<br>> <a href="mailto:Speex-dev@xiph.org">Speex-dev@xiph.org</a><br>> <a href="http://lists.xiph.org/mailman/listinfo/speex-dev">
http://lists.xiph.org/mailman/listinfo/speex-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.apple.com">http://www.apple.com</a><br>A veces me da por ahi. Otras como que no.