Commit a74fdeae authored by smorlat's avatar smorlat
Browse files

- fix bug with speex ec

- videoout compilation errors fixed
- allow vga for mpeg4


git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@156 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 0e03d5f1
......@@ -49,7 +49,7 @@ ResourceIncludes=
MakeIncludes=
Compiler=-DBUILDING_DLL=1_@@_-DORTP_INET6_@@_-DHAVE_LIBAVCODEC_AVCODEC_H_@@_-DHACKED_X264_@@_
CppCompiler=-DBUILDING_DLL=1_@@_
Linker=-no-undefined_@@_--enable-runtime-pseudo-reloc_@@_-lx264_@@_-lmediastreamer2_@@_-lortp_@@_-lavcodec_@@_
Linker=-no-undefined_@@_--enable-runtime-pseudo-reloc_@@_-lx264_@@_-lmediastreamer2_@@_-lortp_@@_-lavcodec_@@_-lswscale_@@_
PreprocDefines=
CompilerSettings=0000000001001000000000
Icon=
......
......@@ -36,8 +36,8 @@ static const int filter_length=2048; /*250 ms*/
typedef struct SpeexECState{
SpeexEchoState *ecstate;
MSBufferizer speak_delay;
int size_delay;
int playback_delay;
int size_delay;
int playback_delay;
MSBufferizer in[2];
int framesize;
int filterlength;
......@@ -55,23 +55,23 @@ static void speex_ec_init(MSFilter *f){
s->framesize=framesize;
s->filterlength=filter_length;
ms_bufferizer_init(&s->speak_delay);
s->size_delay=0;
s->playback_delay=0;
ms_bufferizer_init(&s->speak_delay);
s->size_delay=0;
s->playback_delay=0;
ms_bufferizer_init(&s->in[0]);
ms_bufferizer_init(&s->in[1]);
s->ecstate=speex_echo_state_init(s->framesize,s->filterlength);
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &s->samplerate);
speex_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &s->samplerate);
speex_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
f->data=s;
}
static void speex_ec_uninit(MSFilter *f){
SpeexECState *s=(SpeexECState*)f->data;
ms_bufferizer_uninit(&s->speak_delay);
ms_bufferizer_uninit(&s->speak_delay);
ms_bufferizer_uninit(&s->in[0]);
ms_bufferizer_uninit(&s->in[1]);
speex_echo_state_destroy(s->ecstate);
......@@ -94,38 +94,36 @@ static void speex_ec_process(MSFilter *f){
#ifdef AMD_WIN32_HACK
static int count=0;
#endif
mblk_t *m;
mblk_t *md;
mblk_t *m;
mblk_t *md;
if (s->size_delay<s->playback_delay)
{
while((m=ms_queue_get(f->inputs[0]))!=NULL
if (s->size_delay<s->playback_delay){
while((m=ms_queue_get(f->inputs[0]))!=NULL
&& s->size_delay<s->playback_delay){
// Duplicate queue : one to write to the output speaker, the other will be delayed for AEC
int size=msgdsize(m);
md = copyb(m);
s->size_delay = s->size_delay + size;
ms_queue_put(f->outputs[0],md);
ms_bufferizer_put(&s->in[0],m);
}
while((m=ms_queue_get(f->inputs[1]))!=NULL){
// Duplicate queue : one to write to the output speaker, the other will be delayed for AEC
int size=msgdsize(m);
md = copyb(m);
s->size_delay = s->size_delay + size;
ms_queue_put(f->outputs[0],md);
ms_bufferizer_put(&s->in[0],m);
}
while((m=ms_queue_get(f->inputs[1]))!=NULL){
ms_queue_put(f->outputs[1],m);
}
/* we are now equal and speaker is delayed */
return;
}
/* we are now equal and speaker is delayed */
return;
}
ms_bufferizer_put_from_queue(&s->in[1],f->inputs[1]);
/*read input and put in bufferizers*/
while((m=ms_queue_get(f->inputs[0]))!=NULL){
md = copyb(m);
// Duplicate queue : one to write to the output speaker, the other will be delayed for AEC
ms_bufferizer_put(&s->in[0],m);
ms_bufferizer_put(&s->speak_delay,md);
}
while((m=ms_queue_get(f->inputs[0]))!=NULL){
md = copyb(m);
// Duplicate queue : one to write to the output speaker, the other will be delayed for AEC
ms_bufferizer_put(&s->in[0],m);
ms_bufferizer_put(&s->speak_delay,md);
}
in1=(uint8_t*)alloca(nbytes);
......@@ -150,7 +148,7 @@ static void speex_ec_process(MSFilter *f){
/* we have echo signal */
om1=allocb(nbytes,0);
speex_echo_cancel(s->ecstate,(short*)in1,(short*)om0->b_rptr,(short*)om1->b_wptr,NULL);
speex_preprocess_run(s->den, (short*)om1->b_wptr);
speex_preprocess_run(s->den, (short*)om1->b_wptr);
om1->b_wptr+=nbytes;
ms_queue_put(f->outputs[1],om1);
......@@ -193,13 +191,13 @@ static void speex_ec_process(MSFilter *f){
static void speex_ec_postprocess(MSFilter *f){
SpeexECState *s=(SpeexECState*)f->data;
flushq(&s->in[1].q,0);
flushq(&s->in[0].q,0);
flushq(&s->speak_delay.q,0);
ms_bufferizer_init(&s->in[0]);
ms_bufferizer_init(&s->in[1]);
ms_bufferizer_init(&s->speak_delay);
s->size_delay=0;
flushq(&s->in[1].q,0);
flushq(&s->in[0].q,0);
flushq(&s->speak_delay.q,0);
ms_bufferizer_init(&s->in[0]);
ms_bufferizer_init(&s->in[1]);
ms_bufferizer_init(&s->speak_delay);
s->size_delay=0;
if (s->ecstate!=NULL)
speex_echo_state_destroy(s->ecstate);
......@@ -208,8 +206,8 @@ static void speex_ec_postprocess(MSFilter *f){
s->ecstate=speex_echo_state_init(s->framesize,s->filterlength*(s->samplerate/8000));
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &s->samplerate);
speex_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &s->samplerate);
speex_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
}
static int speex_ec_set_sr(MSFilter *f, void *arg){
......@@ -224,8 +222,8 @@ static int speex_ec_set_sr(MSFilter *f, void *arg){
s->ecstate=speex_echo_state_init(s->framesize,s->filterlength*(s->samplerate/8000));
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &s->samplerate);
speex_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &s->samplerate);
speex_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
return 0;
}
......@@ -240,8 +238,8 @@ static int speex_ec_set_framesize(MSFilter *f, void *arg){
s->ecstate=speex_echo_state_init(s->framesize,s->filterlength*(s->samplerate/8000));
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &s->samplerate);
speex_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &s->samplerate);
speex_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
return 0;
}
......@@ -256,8 +254,8 @@ static int speex_ec_set_filterlength(MSFilter *f, void *arg){
s->ecstate=speex_echo_state_init(s->framesize,s->filterlength*(s->samplerate/8000));
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &s->samplerate);
speex_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &s->samplerate);
speex_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
return 0;
}
......@@ -265,16 +263,15 @@ static int speex_ec_set_playbackdelay(MSFilter *f, void *arg){
SpeexECState *s=(SpeexECState*)f->data;
s->playback_delay = *(int*)arg;
flushq(&s->in[1].q,0);
flushq(&s->in[0].q,0);
flushq(&s->speak_delay.q,0);
ms_bufferizer_init(&s->in[0]);
ms_bufferizer_init(&s->in[1]);
ms_bufferizer_init(&s->speak_delay);
s->size_delay=0;
flushq(&s->in[1].q,0);
flushq(&s->in[0].q,0);
flushq(&s->speak_delay.q,0);
ms_bufferizer_init(&s->in[0]);
ms_bufferizer_init(&s->in[1]);
ms_bufferizer_init(&s->speak_delay);
s->size_delay=0;
speex_echo_state_reset(s->ecstate);
return 0;
return 0;
}
static MSFilterMethod speex_ec_methods[]={
......@@ -314,6 +311,7 @@ MSFilterDesc ms_speex_ec_desc={
.noutputs=2,
.init=speex_ec_init,
.process=speex_ec_process,
.postprocess=speex_ec_postprocess,
.uninit=speex_ec_uninit,
.methods=speex_ec_methods
};
......
......@@ -518,6 +518,10 @@ static int enc_set_br(MSFilter *f, void *arg){
s->vsize.width = MS_VIDEO_SIZE_4CIF_W;
s->vsize.height = MS_VIDEO_SIZE_4CIF_H;
s->fps=17;
}else if (s->maxbr>=800000 && s->codec!=CODEC_ID_H263P){
s->vsize.width = MS_VIDEO_SIZE_VGA_W;
s->vsize.height = MS_VIDEO_SIZE_VGA_H;
s->fps=17;
}else if (s->maxbr>=512000){
s->vsize.width=MS_VIDEO_SIZE_CIF_W;
s->vsize.height=MS_VIDEO_SIZE_CIF_H;
......
......@@ -398,7 +398,7 @@ static void win_display_update(MSDisplay *obj){
ms_error("Could not get window dc");
return;
}
yuv420p_to_rgb(&wd->fb, wd->rgb);
yuv420p_to_rgb(wd, &wd->fb, wd->rgb);
memset(&bi,0,sizeof(bi));
bi.biSize=sizeof(bi);
GetClientRect(wd->window,&rect);
......
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