mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 00:29:21 +00:00
fix for linux compilation
git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@348 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
parent
f08a56d403
commit
bc5891547b
1 changed files with 42 additions and 33 deletions
|
|
@ -17,6 +17,10 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "mediastreamer-config.h"
|
||||
#endif
|
||||
|
||||
#include "mediastreamer2/msfilter.h"
|
||||
#include <math.h>
|
||||
|
||||
|
|
@ -254,35 +258,40 @@ static bool_t should_process(MSFilter *f, ConfState *s){
|
|||
#ifndef DISABLE_SPEEX
|
||||
static double powerspectrum_stat_beyond8K(struct Channel *chan)
|
||||
{
|
||||
spx_int32_t ps_size = 0;
|
||||
spx_int32_t *ps = NULL;
|
||||
double mystat = 0;
|
||||
float fftmul = 1.0 / (32768.0);
|
||||
|
||||
speex_preprocess_ctl(chan->speex_pp, SPEEX_PREPROCESS_GET_PSD_SIZE, &ps_size);
|
||||
ps = (spx_int32_t*)ortp_malloc(sizeof(spx_int32_t)*ps_size);
|
||||
speex_preprocess_ctl(chan->speex_pp, SPEEX_PREPROCESS_GET_PSD, ps);
|
||||
|
||||
|
||||
mystat = 0;
|
||||
for (int i=ps_size/2;i < ps_size; i++) {
|
||||
double yp;
|
||||
yp = sqrtf(sqrtf(static_cast<float>(ps[i]))) - 1.0f;
|
||||
yp = yp * fftmul;
|
||||
yp = MIN(yp * 3000.0, 1.0);
|
||||
mystat = yp + mystat;
|
||||
}
|
||||
|
||||
ortp_free(ps);
|
||||
|
||||
/* value between 0 and 100? */
|
||||
mystat = mystat*100*2/ps_size;
|
||||
if (mystat<0)
|
||||
mystat=0;
|
||||
if (mystat>100)
|
||||
mystat=100;
|
||||
|
||||
return mystat;
|
||||
spx_int32_t ps_size = 0;
|
||||
spx_int32_t *ps = NULL;
|
||||
double mystat = 0;
|
||||
float fftmul = 1.0 / (32768.0);
|
||||
int i;
|
||||
|
||||
speex_preprocess_ctl(chan->speex_pp, SPEEX_PREPROCESS_GET_PSD_SIZE, &ps_size);
|
||||
ps = (spx_int32_t*)ortp_malloc(sizeof(spx_int32_t)*ps_size);
|
||||
speex_preprocess_ctl(chan->speex_pp, SPEEX_PREPROCESS_GET_PSD, ps);
|
||||
|
||||
|
||||
mystat = 0;
|
||||
for (i=ps_size/2;i < ps_size; i++) {
|
||||
double yp;
|
||||
#if defined(__cplusplus)
|
||||
yp = sqrtf(sqrtf(static_cast<float>(ps[i]))) - 1.0f;
|
||||
#else
|
||||
yp = sqrtf(sqrtf((float)(ps[i]))) - 1.0f;
|
||||
#endif
|
||||
yp = yp * fftmul;
|
||||
yp = MIN(yp * 3000.0, 1.0);
|
||||
mystat = yp + mystat;
|
||||
}
|
||||
|
||||
ortp_free(ps);
|
||||
|
||||
/* value between 0 and 100? */
|
||||
mystat = mystat*100*2/ps_size;
|
||||
if (mystat<0)
|
||||
mystat=0;
|
||||
if (mystat>100)
|
||||
mystat=100;
|
||||
|
||||
return mystat;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -395,10 +404,10 @@ static void conf_sum(MSFilter *f, ConfState *s){
|
|||
if (s->enable_halfduplex>0)
|
||||
{
|
||||
double mystat = powerspectrum_stat_beyond8K(chan);
|
||||
//ms_message("is_speaking (chan=%i) -> on/stat=%.3lf", i, mystat);
|
||||
if (mystat>10)
|
||||
{
|
||||
ms_message("is_speaking (chan=%i) -> on/stat=%.3lf", i, mystat);
|
||||
//ms_message("is_speaking (chan=%i) -> on/stat=%.3lf", i, mystat);
|
||||
if (mystat>10)
|
||||
{
|
||||
ms_message("is_speaking (chan=%i) -> on/stat=%.3lf", i, mystat);
|
||||
s->channels[0].is_speaking=20; /* keep RTP muted for the next few ms */
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue