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