Commit 91a4b216 authored by aymeric's avatar aymeric
Browse files

send output with all block of the same size

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@339 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 09ef2796
...@@ -104,12 +104,27 @@ static void speex_ec_process(MSFilter *f){ ...@@ -104,12 +104,27 @@ static void speex_ec_process(MSFilter *f){
int size=msgdsize(m); int size=msgdsize(m);
md = copyb(m); md = copyb(m);
s->size_delay = s->size_delay + size; s->size_delay = s->size_delay + size;
ms_queue_put(f->outputs[0],md); ms_bufferizer_put(&s->speak_delay,md);
ms_bufferizer_put(&s->in[0],m); ms_bufferizer_put(&s->in[0],m);
} }
while((m=ms_queue_get(f->inputs[1]))!=NULL){ /* make sure we always send block with same size */
ms_queue_put(f->outputs[1],m); while (ms_bufferizer_get_avail(&s->speak_delay)>=nbytes)
{
om0=allocb(nbytes,0);
ms_bufferizer_read(&s->speak_delay,(uint8_t*)om0->b_wptr,nbytes);
om0->b_wptr+=nbytes;
ms_queue_put(f->outputs[0],om0);
}
/* make sure we always send block with same size */
ms_bufferizer_put_from_queue(&s->in[1],f->inputs[1]);
while (ms_bufferizer_get_avail(&s->in[1])>=nbytes)
{
om0=allocb(nbytes,0);
ms_bufferizer_read(&s->in[1],(uint8_t*)om0->b_wptr,nbytes);
om0->b_wptr+=nbytes;
ms_queue_put(f->outputs[1],om0);
} }
/* we are now equal and speaker is delayed */ /* we are now equal and speaker is delayed */
return; return;
...@@ -163,7 +178,7 @@ static void speex_ec_process(MSFilter *f){ ...@@ -163,7 +178,7 @@ static void speex_ec_process(MSFilter *f){
count=0; count=0;
} }
#endif #endif
freeb(om0); freeb(om0);
} }
if (ms_bufferizer_get_avail(&s->speak_delay)> 4*320*(s->samplerate/8000)) /* above 4*20ms -> useless */ if (ms_bufferizer_get_avail(&s->speak_delay)> 4*320*(s->samplerate/8000)) /* above 4*20ms -> useless */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment