mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-21 04:38:29 +00:00
- 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
This commit is contained in:
parent
0e03d5f186
commit
a74fdeaee2
4 changed files with 60 additions and 58 deletions
|
|
@ -49,7 +49,7 @@ ResourceIncludes=
|
||||||
MakeIncludes=
|
MakeIncludes=
|
||||||
Compiler=-DBUILDING_DLL=1_@@_-DORTP_INET6_@@_-DHAVE_LIBAVCODEC_AVCODEC_H_@@_-DHACKED_X264_@@_
|
Compiler=-DBUILDING_DLL=1_@@_-DORTP_INET6_@@_-DHAVE_LIBAVCODEC_AVCODEC_H_@@_-DHACKED_X264_@@_
|
||||||
CppCompiler=-DBUILDING_DLL=1_@@_
|
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=
|
PreprocDefines=
|
||||||
CompilerSettings=0000000001001000000000
|
CompilerSettings=0000000001001000000000
|
||||||
Icon=
|
Icon=
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ static const int filter_length=2048; /*250 ms*/
|
||||||
typedef struct SpeexECState{
|
typedef struct SpeexECState{
|
||||||
SpeexEchoState *ecstate;
|
SpeexEchoState *ecstate;
|
||||||
MSBufferizer speak_delay;
|
MSBufferizer speak_delay;
|
||||||
int size_delay;
|
int size_delay;
|
||||||
int playback_delay;
|
int playback_delay;
|
||||||
MSBufferizer in[2];
|
MSBufferizer in[2];
|
||||||
int framesize;
|
int framesize;
|
||||||
int filterlength;
|
int filterlength;
|
||||||
|
|
@ -55,23 +55,23 @@ static void speex_ec_init(MSFilter *f){
|
||||||
s->framesize=framesize;
|
s->framesize=framesize;
|
||||||
s->filterlength=filter_length;
|
s->filterlength=filter_length;
|
||||||
|
|
||||||
ms_bufferizer_init(&s->speak_delay);
|
ms_bufferizer_init(&s->speak_delay);
|
||||||
s->size_delay=0;
|
s->size_delay=0;
|
||||||
s->playback_delay=0;
|
s->playback_delay=0;
|
||||||
|
|
||||||
ms_bufferizer_init(&s->in[0]);
|
ms_bufferizer_init(&s->in[0]);
|
||||||
ms_bufferizer_init(&s->in[1]);
|
ms_bufferizer_init(&s->in[1]);
|
||||||
s->ecstate=speex_echo_state_init(s->framesize,s->filterlength);
|
s->ecstate=speex_echo_state_init(s->framesize,s->filterlength);
|
||||||
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
|
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
|
||||||
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &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_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
|
||||||
|
|
||||||
f->data=s;
|
f->data=s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void speex_ec_uninit(MSFilter *f){
|
static void speex_ec_uninit(MSFilter *f){
|
||||||
SpeexECState *s=(SpeexECState*)f->data;
|
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[0]);
|
||||||
ms_bufferizer_uninit(&s->in[1]);
|
ms_bufferizer_uninit(&s->in[1]);
|
||||||
speex_echo_state_destroy(s->ecstate);
|
speex_echo_state_destroy(s->ecstate);
|
||||||
|
|
@ -94,38 +94,36 @@ static void speex_ec_process(MSFilter *f){
|
||||||
#ifdef AMD_WIN32_HACK
|
#ifdef AMD_WIN32_HACK
|
||||||
static int count=0;
|
static int count=0;
|
||||||
#endif
|
#endif
|
||||||
mblk_t *m;
|
mblk_t *m;
|
||||||
mblk_t *md;
|
mblk_t *md;
|
||||||
|
|
||||||
if (s->size_delay<s->playback_delay)
|
if (s->size_delay<s->playback_delay){
|
||||||
{
|
while((m=ms_queue_get(f->inputs[0]))!=NULL
|
||||||
while((m=ms_queue_get(f->inputs[0]))!=NULL
|
|
||||||
&& s->size_delay<s->playback_delay){
|
&& s->size_delay<s->playback_delay){
|
||||||
// Duplicate queue : one to write to the output speaker, the other will be delayed for AEC
|
// Duplicate queue : one to write to the output speaker, the other will be delayed for AEC
|
||||||
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_queue_put(f->outputs[0],md);
|
||||||
ms_bufferizer_put(&s->in[0],m);
|
ms_bufferizer_put(&s->in[0],m);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
while((m=ms_queue_get(f->inputs[1]))!=NULL){
|
||||||
|
|
||||||
while((m=ms_queue_get(f->inputs[1]))!=NULL){
|
|
||||||
ms_queue_put(f->outputs[1],m);
|
ms_queue_put(f->outputs[1],m);
|
||||||
}
|
}
|
||||||
/* we are now equal and speaker is delayed */
|
/* we are now equal and speaker is delayed */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ms_bufferizer_put_from_queue(&s->in[1],f->inputs[1]);
|
ms_bufferizer_put_from_queue(&s->in[1],f->inputs[1]);
|
||||||
|
|
||||||
/*read input and put in bufferizers*/
|
/*read input and put in bufferizers*/
|
||||||
while((m=ms_queue_get(f->inputs[0]))!=NULL){
|
while((m=ms_queue_get(f->inputs[0]))!=NULL){
|
||||||
md = copyb(m);
|
md = copyb(m);
|
||||||
// Duplicate queue : one to write to the output speaker, the other will be delayed for AEC
|
// 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->in[0],m);
|
||||||
ms_bufferizer_put(&s->speak_delay,md);
|
ms_bufferizer_put(&s->speak_delay,md);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
in1=(uint8_t*)alloca(nbytes);
|
in1=(uint8_t*)alloca(nbytes);
|
||||||
|
|
@ -150,7 +148,7 @@ static void speex_ec_process(MSFilter *f){
|
||||||
/* we have echo signal */
|
/* we have echo signal */
|
||||||
om1=allocb(nbytes,0);
|
om1=allocb(nbytes,0);
|
||||||
speex_echo_cancel(s->ecstate,(short*)in1,(short*)om0->b_rptr,(short*)om1->b_wptr,NULL);
|
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;
|
om1->b_wptr+=nbytes;
|
||||||
ms_queue_put(f->outputs[1],om1);
|
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){
|
static void speex_ec_postprocess(MSFilter *f){
|
||||||
SpeexECState *s=(SpeexECState*)f->data;
|
SpeexECState *s=(SpeexECState*)f->data;
|
||||||
flushq(&s->in[1].q,0);
|
flushq(&s->in[1].q,0);
|
||||||
flushq(&s->in[0].q,0);
|
flushq(&s->in[0].q,0);
|
||||||
flushq(&s->speak_delay.q,0);
|
flushq(&s->speak_delay.q,0);
|
||||||
ms_bufferizer_init(&s->in[0]);
|
ms_bufferizer_init(&s->in[0]);
|
||||||
ms_bufferizer_init(&s->in[1]);
|
ms_bufferizer_init(&s->in[1]);
|
||||||
ms_bufferizer_init(&s->speak_delay);
|
ms_bufferizer_init(&s->speak_delay);
|
||||||
s->size_delay=0;
|
s->size_delay=0;
|
||||||
|
|
||||||
if (s->ecstate!=NULL)
|
if (s->ecstate!=NULL)
|
||||||
speex_echo_state_destroy(s->ecstate);
|
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->ecstate=speex_echo_state_init(s->framesize,s->filterlength*(s->samplerate/8000));
|
||||||
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
|
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
|
||||||
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &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_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int speex_ec_set_sr(MSFilter *f, void *arg){
|
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->ecstate=speex_echo_state_init(s->framesize,s->filterlength*(s->samplerate/8000));
|
||||||
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
|
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
|
||||||
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &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_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
|
||||||
return 0;
|
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->ecstate=speex_echo_state_init(s->framesize,s->filterlength*(s->samplerate/8000));
|
||||||
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
|
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
|
||||||
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &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_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
|
||||||
return 0;
|
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->ecstate=speex_echo_state_init(s->framesize,s->filterlength*(s->samplerate/8000));
|
||||||
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
|
s->den = speex_preprocess_state_init(s->framesize, s->samplerate);
|
||||||
speex_echo_ctl(s->ecstate, SPEEX_ECHO_SET_SAMPLING_RATE, &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_preprocess_ctl(s->den, SPEEX_PREPROCESS_SET_ECHO_STATE, s->ecstate);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -265,16 +263,15 @@ static int speex_ec_set_playbackdelay(MSFilter *f, void *arg){
|
||||||
SpeexECState *s=(SpeexECState*)f->data;
|
SpeexECState *s=(SpeexECState*)f->data;
|
||||||
s->playback_delay = *(int*)arg;
|
s->playback_delay = *(int*)arg;
|
||||||
|
|
||||||
flushq(&s->in[1].q,0);
|
flushq(&s->in[1].q,0);
|
||||||
flushq(&s->in[0].q,0);
|
flushq(&s->in[0].q,0);
|
||||||
flushq(&s->speak_delay.q,0);
|
flushq(&s->speak_delay.q,0);
|
||||||
ms_bufferizer_init(&s->in[0]);
|
ms_bufferizer_init(&s->in[0]);
|
||||||
ms_bufferizer_init(&s->in[1]);
|
ms_bufferizer_init(&s->in[1]);
|
||||||
ms_bufferizer_init(&s->speak_delay);
|
ms_bufferizer_init(&s->speak_delay);
|
||||||
s->size_delay=0;
|
s->size_delay=0;
|
||||||
speex_echo_state_reset(s->ecstate);
|
speex_echo_state_reset(s->ecstate);
|
||||||
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static MSFilterMethod speex_ec_methods[]={
|
static MSFilterMethod speex_ec_methods[]={
|
||||||
|
|
@ -314,6 +311,7 @@ MSFilterDesc ms_speex_ec_desc={
|
||||||
.noutputs=2,
|
.noutputs=2,
|
||||||
.init=speex_ec_init,
|
.init=speex_ec_init,
|
||||||
.process=speex_ec_process,
|
.process=speex_ec_process,
|
||||||
|
.postprocess=speex_ec_postprocess,
|
||||||
.uninit=speex_ec_uninit,
|
.uninit=speex_ec_uninit,
|
||||||
.methods=speex_ec_methods
|
.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.width = MS_VIDEO_SIZE_4CIF_W;
|
||||||
s->vsize.height = MS_VIDEO_SIZE_4CIF_H;
|
s->vsize.height = MS_VIDEO_SIZE_4CIF_H;
|
||||||
s->fps=17;
|
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){
|
}else if (s->maxbr>=512000){
|
||||||
s->vsize.width=MS_VIDEO_SIZE_CIF_W;
|
s->vsize.width=MS_VIDEO_SIZE_CIF_W;
|
||||||
s->vsize.height=MS_VIDEO_SIZE_CIF_H;
|
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");
|
ms_error("Could not get window dc");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
yuv420p_to_rgb(&wd->fb, wd->rgb);
|
yuv420p_to_rgb(wd, &wd->fb, wd->rgb);
|
||||||
memset(&bi,0,sizeof(bi));
|
memset(&bi,0,sizeof(bi));
|
||||||
bi.biSize=sizeof(bi);
|
bi.biSize=sizeof(bi);
|
||||||
GetClientRect(wd->window,&rect);
|
GetClientRect(wd->window,&rect);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue