windows build tweaks

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10627 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-12-05 20:01:39 +00:00
parent 643d5ac364
commit 281a102444

View File

@ -31,9 +31,15 @@
#include <switch.h> #include <switch.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <strings.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#ifdef WIN32
#include <float.h>
#define ISNAN(x) (!!(_isnan(x)))
#else
#define ISNAN(x) ((x)== NAN)
#endif
/* Number of points for beep detection */ /* Number of points for beep detection */
#define POINTS 32 #define POINTS 32
@ -207,7 +213,7 @@ static switch_bool_t process_data(vmd_session_info_t *vmd_info,
double pts[P]; double pts[P];
int16_t *data; int16_t *data;
int16_t max; int16_t max;
ssize_t len; switch_ssize_t len;
len = frame->samples * sizeof(int16_t); len = frame->samples * sizeof(int16_t);
data = (int16_t *)frame->data; data = (int16_t *)frame->data;
@ -330,13 +336,13 @@ static void find_beep(vmd_session_info_t *vmd_info, switch_frame_t *frame)
for(i = 0; i < POINTS; k++, k %= POINTS, i++){ for(i = 0; i < POINTS; k++, k %= POINTS, i++){
m[i] = vmd_info->points[k].freq; m[i] = vmd_info->points[k].freq;
if(m[i] == NAN) m[i] = 0.0; if(ISNAN(m[i])) m[i] = 0.0;
} }
med = median(m, POINTS); med = median(m, POINTS);
if(med == NAN){ if(ISNAN(med)){
for(i = 0; i < POINTS; i++){ for(i = 0; i < POINTS; i++){
if(m[i] != NAN){ if(!ISNAN(m[i])){
med = m[i]; med = m[i];
break; break;
} }
@ -354,7 +360,6 @@ static void find_beep(vmd_session_info_t *vmd_info, switch_frame_t *frame)
} }
} }
if(c >= VALID){ if(c >= VALID){
vmd_info->state = BEEP_DETECTED; vmd_info->state = BEEP_DETECTED;
vmd_info->beep_freq = med; vmd_info->beep_freq = med;
@ -514,10 +519,10 @@ SWITCH_STANDARD_APP(vmd_start_function)
vmd_info->state = BEEP_NOT_DETECTED; vmd_info->state = BEEP_NOT_DETECTED;
vmd_info->session = session; vmd_info->session = session;
vmd_info->pos = 0; vmd_info->pos = 0;
/* /*
vmd_info->data = NULL; vmd_info->data = NULL;
vmd_info->data_len = 0; vmd_info->data_len = 0;
*/ */
for(i = 0; i < POINTS; i++){ for(i = 0; i < POINTS; i++){
vmd_info->points[i].freq = 0.0; vmd_info->points[i].freq = 0.0;
vmd_info->points[i].ampl = 0.0; vmd_info->points[i].ampl = 0.0;
@ -538,11 +543,9 @@ SWITCH_STANDARD_APP(vmd_start_function)
SWITCH_LOG_ERROR, SWITCH_LOG_ERROR,
"Failure hooking to stream\n" "Failure hooking to stream\n"
); );
return; return;
} }
switch_channel_set_private(channel, "_vmd_", bug); switch_channel_set_private(channel, "_vmd_", bug);
} }
@ -565,7 +568,7 @@ SWITCH_STANDARD_API(vmd_api_main)
switch_media_bug_t *bug; switch_media_bug_t *bug;
vmd_session_info_t *vmd_info; vmd_session_info_t *vmd_info;
switch_channel_t *channel; switch_channel_t *channel;
switch_event_t *event; // switch_event_t *event;
switch_status_t status; switch_status_t status;
int argc; int argc;
char *argv[VMD_PARAMS]; char *argv[VMD_PARAMS];