Commit b18e5f12 authored by Ghislain MARY's avatar Ghislain MARY

Fix compilation warnings when building for Windows 10.

parent 9f54c7f4
......@@ -113,7 +113,7 @@ MS2_PUBLIC void ms_queue_destroy(MSQueue *q);
struct _MSBufferizer{
queue_t q;
int size;
size_t size;
};
typedef struct _MSBufferizer MSBufferizer;
......@@ -136,7 +136,7 @@ MS2_PUBLIC int ms_bufferizer_read(MSBufferizer *obj, uint8_t *data, int datalen)
MS2_PUBLIC void ms_bufferizer_fill_current_metas(MSBufferizer *obj, mblk_t *m);
/* returns the number of bytes available in the bufferizer*/
static MS2_INLINE int ms_bufferizer_get_avail(MSBufferizer *obj){
static MS2_INLINE size_t ms_bufferizer_get_avail(MSBufferizer *obj){
return obj->size;
}
......
......@@ -97,7 +97,7 @@ static int channel_flow_control(Channel *chan, int threshold, uint64_t time){
chan->min_fullness=-1;
return skip;
}
size=ms_bufferizer_get_avail(&chan->bufferizer);
size=(int)ms_bufferizer_get_avail(&chan->bufferizer);
if (chan->min_fullness==-1 || chan->min_fullness<size) chan->min_fullness=size;
if (time-chan->last_flow_control>=5000){
if (chan->min_fullness>=threshold){
......
......@@ -43,7 +43,7 @@ static void adapter_uninit(MSFilter *f){
static void adapter_process(MSFilter *f){
AdapterState *s=(AdapterState*)f->data;
mblk_t *im,*om;
int msgsize;
size_t msgsize;
while((im=ms_queue_get(f->inputs[0]))!=NULL){
if (s->inputchans==s->outputchans){
......
......@@ -63,8 +63,8 @@ static void dtmfgen_init(MSFilter *f){
s->pos=0;
s->nosamples_time=0;
s->silence=0;
s->default_amplitude=0.2;
s->amplitude=(s->default_amplitude*0.7*32767);
s->default_amplitude=0.2f;
s->amplitude=(int)(s->default_amplitude*0.7*32767);
s->repeat_count=0;
f->data=s;
}
......@@ -159,7 +159,7 @@ static int dtmfgen_put(MSFilter *f, void *arg){
s->highfreq=s->highfreq/s->rate;
s->dur=s->rate/10; /*100 ms duration */
s->silence=0;
s->amplitude=s->default_amplitude*32767*0.7;
s->amplitude=(int)(s->default_amplitude*32767*0.7);
s->current_tone.tone_name[0]=dtmf[0];
s->current_tone.tone_name[1]=0;
s->current_tone.interval=0;
......@@ -181,7 +181,7 @@ static int dtmfgen_play_tone(MSFilter *f, void *arg){
s->lowfreq=((float)def->frequencies[0])/(float)s->rate;
s->highfreq=((float)def->frequencies[1])/(float)s->rate;;
s->silence=0;
s->amplitude=((float)def->amplitude)* 0.7*32767.0;
s->amplitude=(int)(def->amplitude* 0.7*32767.0);
s->repeat_count=0;
s->playing=TRUE;
ms_filter_unlock(f);
......@@ -314,7 +314,7 @@ static void dtmfgen_process(MSFilter *f){
strncpy(ev.tone_name,s->current_tone.tone_name,sizeof(ev.tone_name));
ms_filter_notify(f,MS_DTMF_GEN_EVENT,&ev);
}
nsamples=(m->b_wptr-m->b_rptr)/(2*s->nchannels);
nsamples=(int)(m->b_wptr-m->b_rptr)/(2*s->nchannels);
write_dtmf(s, (int16_t*)m->b_rptr,nsamples);
}
ms_queue_put(f->outputs[0],m);
......
......@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef MS_FIXED_POINT
#define GAIN_ZERODB 20000
#else
#define GAIN_ZERODB 1.0
#define GAIN_ZERODB 1.0f
#endif
#define EQUALIZER_DEFAULT_RATE 8000
......@@ -47,7 +47,7 @@ typedef struct _EqualizerState{
static void equalizer_state_flatten(EqualizerState *s){
int i;
ms_word16_t val=GAIN_ZERODB/s->nfft;
ms_word16_t val=(ms_word16_t)(GAIN_ZERODB/s->nfft);
s->fft_cpx[0]=val;
for(i=1;i<s->nfft;i+=2)
s->fft_cpx[i]=val;
......@@ -150,7 +150,7 @@ static void equalizer_state_set(EqualizerState *s, int freq_0, float gain, int f
//int low,high;
int i, f;
int delta_f = equalizer_state_index2hz(s, 1);
float sqrt_gain = sqrt(gain);
float sqrt_gain = (float)sqrt(gain);
int mid = equalizer_state_hz_to_index(s, freq_0);
freq_bw-= delta_f/2; /* subtract a constant - compensates for limited fft steepness at low f */
if (freq_bw < delta_f/2)
......@@ -210,8 +210,8 @@ static void norm_and_apodize(ms_word16_t *s, int len){
float x;
float w;
for(i=0;i<len;++i){
x=(float)i*2*M_PI/(float)len;
w=0.54 - (0.46*cos(x));
x=(float)((float)i*2*M_PI/(float)len);
w=(float)(0.54 - (0.46*cos(x)));
//w=0.42 - (0.5*cos(x)) + (0.08*cos(2*x));
s[i]=w*(float)s[i];
}
......@@ -285,7 +285,7 @@ static void equalizer_process(MSFilter *f){
EqualizerState *s=(EqualizerState*)f->data;
while((m=ms_queue_get(f->inputs[0]))!=NULL){
if (s->active){
equalizer_state_run(s,(int16_t*)m->b_rptr,(m->b_wptr-m->b_rptr)/2);
equalizer_state_run(s,(int16_t*)m->b_rptr,(int)((m->b_wptr-m->b_rptr)/2));
}
ms_queue_put(f->outputs[0],m);
}
......@@ -294,14 +294,14 @@ static void equalizer_process(MSFilter *f){
static int equalizer_set_gain(MSFilter *f, void *data){
EqualizerState *s=(EqualizerState*)f->data;
MSEqualizerGain *d=(MSEqualizerGain*)data;
equalizer_state_set(s,d->frequency,d->gain,d->width);
equalizer_state_set(s,(int)d->frequency,d->gain,(int)d->width);
return 0;
}
static int equalizer_get_gain(MSFilter *f, void *data){
EqualizerState *s=(EqualizerState*)f->data;
MSEqualizerGain *d=(MSEqualizerGain*)data;
d->gain=equalizer_state_get(s,d->frequency);
d->gain=equalizer_state_get(s,(int)d->frequency);
d->width=0;
return 0;
}
......
......@@ -75,7 +75,7 @@ static void discard_well_choosed_samples(mblk_t *m, int nsamples, int todrop)
mblk_t *ms_audio_flow_controller_process(MSAudioFlowController *ctl, mblk_t *m){
if (ctl->total_samples > 0 && ctl->target_samples > 0) {
int nsamples = (m->b_wptr - m->b_rptr) / 2;
int nsamples = (int)((m->b_wptr - m->b_rptr) / 2);
int th_dropped;
int todrop;
......
......@@ -75,7 +75,7 @@ static void generic_plc_process(MSFilter *f) {
while((m=ms_queue_get(f->inputs[0]))!=NULL){
int transitionBufferSize = mgps->rate*sizeof(int16_t)*TRANSITION_DELAY/1000;
unsigned char buf[128];
unsigned int time = (1000*(m->b_wptr - m->b_rptr))/(mgps->rate*sizeof(int16_t)*mgps->nchannels);
unsigned int time = (unsigned int)((1000*(m->b_wptr - m->b_rptr))/(mgps->rate*sizeof(int16_t)*mgps->nchannels));
ms_concealer_inc_sample_time(mgps->concealer, f->ticker->time, time, TRUE);
/* introduce 16 sample delay (2ms) */
......
......@@ -93,7 +93,7 @@ static void enc_process(MSFilter *f){
unsigned int unitary_buff_size = sizeof(int16_t)*160;
unsigned int buff_size = unitary_buff_size*s->ptime/20;
int16_t* buff;
int offset;
unsigned int offset;
while((im=ms_queue_get(f->inputs[0]))!=NULL){
ms_bufferizer_put(s->bufferizer,im);
......
......@@ -204,7 +204,7 @@ static void dec_process(MSFilter *f)
mblk_t *im;
while((im=ms_queue_get(f->inputs[0]))) {
network_to_host((int16_t*)im->b_rptr,(im->b_wptr-im->b_rptr)/2);
network_to_host((int16_t*)im->b_rptr,(int)((im->b_wptr-im->b_rptr)/2));
ms_queue_put(f->outputs[0],im);
}
};
......
......@@ -54,7 +54,7 @@ static void rec_process(MSFilter *f){
ms_mutex_lock(&f->lock);
if (s->state==MSRecorderRunning){
while(it!=NULL){
int len=it->b_wptr-it->b_rptr;
int len=(int)(it->b_wptr-it->b_rptr);
if ((err=write(s->fd,it->b_rptr,len))!=len){
if (err<0)
ms_warning("MSFileRec: fail to write %i bytes: %s",len,strerror(errno));
......
......@@ -206,7 +206,7 @@ static void dec_process(MSFilter *f)
mblk_t *om;
while((im=ms_queue_get(f->inputs[0]))) {
int payloadlen = im->b_wptr - im->b_rptr;
int payloadlen = (int)(im->b_wptr - im->b_rptr);
int declen;
om=allocb(payloadlen*4,0);
......
......@@ -303,7 +303,7 @@ static void compute_max_bitrate(OpusEncData *d, int ptimeStep) {
if (normalized_cbr<6000) {
int initial_value = normalized_cbr;
normalized_cbr = 6000;
d->max_network_bitrate = (normalized_cbr/(pps*8) + 12 + 8 + 20) *8*pps;
d->max_network_bitrate = (int)((normalized_cbr/(pps*8) + 12 + 8 + 20) *8*pps);
ms_warning("Opus encoder does not support bitrate [%i]. Instead set to 6kbps, network bitrate [%d]", initial_value, d->max_network_bitrate);
}
if (d->maxaveragebitrate>0)
......@@ -312,7 +312,7 @@ static void compute_max_bitrate(OpusEncData *d, int ptimeStep) {
if (normalized_cbr>maxaveragebitrate) {
int initial_value = normalized_cbr;
normalized_cbr = maxaveragebitrate;
d->max_network_bitrate = (normalized_cbr/(pps*8) + 12 + 8 + 20) *8*pps;
d->max_network_bitrate = (int)((normalized_cbr/(pps*8) + 12 + 8 + 20) *8*pps);
ms_warning("Opus encoder cannot set codec bitrate to [%i] because of maxaveragebitrate constraint or absolute maximum bitrate value. New network bitrate is [%i]", initial_value, d->max_network_bitrate);
}
ms_message("MSOpusEnc: codec bitrate set to [%i] with ptime [%i]", normalized_cbr, d->ptime);
......@@ -694,7 +694,7 @@ static void ms_opus_dec_process(MSFilter *f) {
while ((im = ms_queue_get(f->inputs[0])) != NULL) {
om = allocb(5760 * d->channels * SIGNAL_SAMPLE_SIZE, 0); /* 5760 is the maximum number of sample in a packet (120ms at 48KHz) */
frames = opus_decode(d->state, (const unsigned char *)im->b_rptr, im->b_wptr - im->b_rptr, (opus_int16 *)om->b_wptr, 5760, 0);
frames = opus_decode(d->state, (const unsigned char *)im->b_rptr, (opus_int32)(im->b_wptr - im->b_rptr), (opus_int16 *)om->b_wptr, 5760, 0);
if (frames < 0) {
ms_warning("Opus decoder error: %s", opus_strerror(frames));
......
......@@ -87,14 +87,14 @@ static void resample_uninit(MSFilter *obj){
static int resample_channel_adapt(int in_nchannels, int out_nchannels, mblk_t *im, mblk_t **om) {
if ((in_nchannels == 2) && (out_nchannels == 1)) {
int msgsize = msgdsize(im) / 2;
size_t msgsize = msgdsize(im) / 2;
*om = allocb(msgsize, 0);
for (; im->b_rptr < im->b_wptr; im->b_rptr += 4, (*om)->b_wptr += 2) {
*(int16_t *)(*om)->b_wptr = *(int16_t *)im->b_rptr;
}
return 1;
} else if ((in_nchannels == 1) && (out_nchannels == 2)) {
int msgsize = msgdsize(im) * 2;
size_t msgsize = msgdsize(im) * 2;
*om = allocb(msgsize, 0);
for (; im->b_rptr < im->b_wptr; im->b_rptr += 2, (*om)->b_wptr += 4) {
((int16_t *)(*om)->b_wptr)[0] = *(int16_t *)im->b_rptr;
......@@ -156,7 +156,7 @@ static void resample_process_ms2(MSFilter *obj){
while((im=ms_queue_get(obj->inputs[0]))!=NULL){
unsigned int inlen=(im->b_wptr-im->b_rptr)/(2*dt->in_nchannels);
unsigned int inlen=(int)((im->b_wptr-im->b_rptr)/(2*dt->in_nchannels));
unsigned int outlen=((inlen*dt->output_rate)/dt->input_rate)+1;
unsigned int inlen_orig=inlen;
om=allocb(outlen*2*dt->in_nchannels,0);
......
......@@ -572,14 +572,14 @@ static void dec_process(MSFilter *f){
bool_t bits_initd=FALSE;
while((im=ms_queue_get(f->inputs[0]))!=NULL){
int rem_bits=(im->b_wptr-im->b_rptr)*8;
int rem_bits=(int)((im->b_wptr-im->b_rptr)*8);
if (!bits_initd) {
speex_bits_init(&bits);
bits_initd=TRUE;
}else speex_bits_reset(&bits);
speex_bits_read_from(&bits,(char*)im->b_rptr,im->b_wptr-im->b_rptr);
speex_bits_read_from(&bits,(char*)im->b_rptr,(int)(im->b_wptr-im->b_rptr));
/* support for multiple frame in one RTP packet */
do{
......
......@@ -32,9 +32,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <math.h>
static const float max_e = (32768* 0.7); /* 0.7 - is RMS factor */
static const float coef = 0.2; /* floating averaging coeff. for energy */
static const float silence_threshold=0.01;
static const float max_e = (32768* 0.7f); /* 0.7 - is RMS factor */
static const float coef = 0.2f; /* floating averaging coeff. for energy */
static const float silence_threshold=0.01f;
typedef struct _VadDtxContext{
int silence_mode;/*set to 1 if a silence period is running*/
......@@ -78,8 +78,8 @@ static void update_energy(VadDtxContext *v, int16_t *signal, int numsamples, uin
int s=signal[i];
acc += s * s;
}
en = (sqrt(acc / numsamples)+1) / max_e;
v->energy = (en * coef) + v->energy * (1.0 - coef);
en = (float)((sqrt(acc / numsamples)+1) / max_e);
v->energy = (en * coef) + v->energy * (1.0f - coef);
ortp_extremum_record_max(&v->max,curtime,v->energy);
//ms_message("Energy=%f, current max=%f",v->energy, ortp_extremum_get_current(&v->max));
}
......@@ -127,7 +127,7 @@ static void vad_dtx_process(MSFilter *f){
#else
while((m=ms_queue_get(f->inputs[0]))!=NULL){
update_energy(ctx,(int16_t*)m->b_rptr, (m->b_wptr - m->b_rptr) / 2, f->ticker->time);
update_energy(ctx,(int16_t*)m->b_rptr, (int)((m->b_wptr - m->b_rptr) / 2), f->ticker->time);
if (ortp_extremum_get_current(&ctx->max)<silence_threshold){
if (!ctx->silence_mode){
......
......@@ -30,15 +30,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <speex/speex_preprocess.h>
#endif
static const float max_e = (32768* 0.7); /* 0.7 - is RMS factor */
static const float coef = 0.2; /* floating averaging coeff. for energy */
static const float max_e = (32768* 0.7f); /* 0.7 - is RMS factor */
static const float coef = 0.2f; /* floating averaging coeff. for energy */
//static const float gain_k = 0.02; /* floating averaging coeff. for gain */
static const float vol_upramp = 0.4;
static const float vol_downramp = 0.4; /* not yet runtime parameterizable */
static const float vol_upramp = 0.4f;
static const float vol_downramp = 0.4f; /* not yet runtime parameterizable */
static const float en_weight=4.0;
static const float noise_thres=0.1;
static const float noise_thres=0.1f;
static const float transmit_thres=4;
static const float min_ng_floorgain=0.005;
static const float min_ng_floorgain=0.005f;
static const float agc_threshold=0.5;
......@@ -199,14 +199,14 @@ static MS2_INLINE float compute_gain(Volume *v, float energy, float weight) {
static float volume_echo_avoider_process(Volume *v, mblk_t *om) {
static int counter;
float peer_e,peer_pk;
int nsamples = ((om->b_wptr - om->b_rptr) / 2);
int nsamples = (int)((om->b_wptr - om->b_rptr) / 2);
float mic_spk_ratio;
peer_e = ((Volume *)(v->peer->data))->energy;
peer_pk=((Volume *)(v->peer->data))->energy;
if (peer_pk>v->lt_speaker_en)
v->lt_speaker_en=peer_pk;
else v->lt_speaker_en=(0.005*peer_pk)+(0.995*v->lt_speaker_en);
else v->lt_speaker_en=(0.005f*peer_pk)+(0.995f*v->lt_speaker_en);
mic_spk_ratio=(v->energy/(v->lt_speaker_en+v->ea_thres));
/* where v->target_gain is not set, it is kept steady - not to modify elsewhere! */
......@@ -239,7 +239,7 @@ static float volume_echo_avoider_process(Volume *v, mblk_t *om) {
static void volume_noise_gate_process(Volume *v , float energy, mblk_t *om){
static int counter;
float tgain = v->ng_floorgain; /* start with floorgain */
int nsamples=((om->b_wptr-om->b_rptr)/2);
int nsamples=(int)((om->b_wptr-om->b_rptr)/2);
if (energy > v->ng_threshold) {
v->ng_noise_dur = v->ng_cut_time;
tgain = 1.0;
......@@ -252,7 +252,7 @@ static void volume_noise_gate_process(Volume *v , float energy, mblk_t *om){
}
/* simple averaging computation is adequate here: fast rise, relatively slower decrease */
/* of gain - ears impression */
v->ng_gain = v->ng_gain*0.75 + tgain*0.25;
v->ng_gain = v->ng_gain*0.75f + tgain*0.25f;
if (!(++counter % 10))
ms_debug("%d: nglevel=%f, energy=%f, tgain=%f, ng_gain=%f",
(v->peer!=NULL)?1:0, energy, v->energy, tgain, v->ng_gain);
......@@ -261,7 +261,7 @@ static void volume_noise_gate_process(Volume *v , float energy, mblk_t *om){
static int volume_set_db_gain(MSFilter *f, void *gain){
float *fgain=(float*)gain;
Volume *v=(Volume*)f->data;
v->gain = v->static_gain = pow(10,(*fgain)/10);
v->gain = v->static_gain = (float)pow(10,(*fgain)/10);
ms_message("MSVolume set gain to [%f db], [%f] linear",*fgain,v->gain);
return 0;
}
......@@ -398,8 +398,8 @@ static void update_energy(Volume *v, int16_t *signal, int numsamples, uint64_t c
if (lp > pk)
pk = lp;
}
en = (sqrt(acc / numsamples)+1) / max_e;
v->energy = (en * coef) + v->energy * (1.0 - coef);
en = (float)((sqrt(acc / numsamples)+1) / max_e);
v->energy = (en * coef) + v->energy * (1.0f - coef);
v->level_pk = (float)pk / max_e;
v->instant_energy = en;// currently non-averaged energy seems better (short artefacts)
ortp_extremum_record_max(&v->max,curtime,v->energy);
......@@ -428,7 +428,7 @@ static void apply_gain(Volume *v, mblk_t *m, float tgain) {
}
gain=v->gain * v->ng_gain;
intgain = gain* 4096;
intgain = (int32_t)(gain* 4096);
//if (v->peer) ms_message("MSVolume:%p Applying gain %5f, v->gain=%5f, tgain=%5f, ng_gain=%5f",v,gain,v->gain,tgain,v->ng_gain);
......@@ -441,7 +441,7 @@ static void apply_gain(Volume *v, mblk_t *m, float tgain) {
*sample = saturate(((*sample - v->dc_offset) * intgain) / 4096);
}
/* offset smoothing */
v->dc_offset = (v->dc_offset*7 + dc_offset*2/(m->b_wptr - m->b_rptr)) / 8;
v->dc_offset = (v->dc_offset*7 + dc_offset*2/(int)(m->b_wptr - m->b_rptr)) / 8;
}else if (gain!=1){
for ( sample=(int16_t*)m->b_rptr;
sample<(int16_t*)m->b_wptr;
......@@ -512,7 +512,7 @@ static void volume_process(MSFilter *f){
}else{
/*light processing: no agc. Work in place in the input buffer*/
while((m=ms_queue_get(f->inputs[0]))!=NULL){
update_energy(v,(int16_t*)m->b_rptr, (m->b_wptr - m->b_rptr) / 2, f->ticker->time);
update_energy(v,(int16_t*)m->b_rptr, (int)((m->b_wptr - m->b_rptr) / 2), f->ticker->time);
target_gain = v->static_gain;
if (v->noise_gate_enabled)
......
......@@ -47,7 +47,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
static const int framesize=64;
static const int flow_control_interval_ms=5000;
static const uint32_t flow_control_interval_ms=5000;
typedef struct SpeexECState{
......@@ -135,7 +135,7 @@ static void apply_config(SpeexECState *s){
ms_error("Could not decode base64 %s",s->state_str);
return;
}
blob=speex_echo_state_blob_new_from_memory(buffer,buflen);
blob=speex_echo_state_blob_new_from_memory(buffer,(int)buflen);
if (blob==NULL){
ms_error("Could not create blob from config string");
return;
......@@ -263,7 +263,7 @@ static void speex_ec_process(MSFilter *f){
int avail_samples;
if (!s->echostarted) s->echostarted=TRUE;
if ((avail=ms_bufferizer_get_avail(&s->delayed_ref))<((s->nominal_ref_samples*2)+nbytes)){
if ((avail=(int)ms_bufferizer_get_avail(&s->delayed_ref))<((s->nominal_ref_samples*2)+nbytes)){
/*we don't have enough to read in a reference signal buffer, inject silence instead*/
avail=nbytes;
refm=allocb(nbytes,0);
......
......@@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAX_SCANS 10
static const float energy_min_threshold=0.01;
static const float energy_min_threshold=0.01f;
typedef struct _GoertzelState{
uint64_t starttime;
......@@ -64,7 +64,7 @@ static float goertzel_state_run(GoertzelState *gs,int16_t *samples, int nsample
freq_en= (q1*q1) + (q2*q2) - (q1*q2*gs->coef);
/*return a relative frequency energy compared over the total signal energy */
return freq_en/(total_energy*(float)nsamples*0.5);
return freq_en/(total_energy*(float)nsamples*0.5f);
}
static float compute_energy(int16_t *samples, int nsamples){
......
......@@ -376,7 +376,7 @@ void ms_usleep(uint64_t usec){
#else
HANDLE sleepEvent = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS);
if (!sleepEvent) return;
WaitForSingleObjectEx(sleepEvent, usec / 1000, FALSE);
WaitForSingleObjectEx(sleepEvent, (DWORD)(usec / 1000), FALSE);
#endif
#else
struct timespec ts,rem;
......@@ -445,7 +445,7 @@ int ms_concealer_inc_sample_time(MSConcealerContext* obj, uint64_t current_time,
}
obj->sample_time+=time_increment;
if (obj->plc_start_time!=-1 && got_packet){
plc_duration=current_time-obj->plc_start_time;
plc_duration=(int)(current_time-obj->plc_start_time);
obj->plc_start_time=-1;
if (plc_duration>obj->max_plc_time) plc_duration=obj->max_plc_time;
}
......
......@@ -87,7 +87,7 @@ int ms_bufferizer_read(MSBufferizer *obj, uint8_t *data, int datalen){
/* first store current meta information in the _q_stopper field the queue, just to reuse space*/
mblk_meta_copy(m, &obj->q._q_stopper);
while(sz<datalen){
cplen=MIN(m->b_wptr-m->b_rptr,datalen-sz);
cplen=MIN((int)(m->b_wptr-m->b_rptr),datalen-sz);
if (data) memcpy(data+sz,m->b_rptr,cplen);
sz+=cplen;
m->b_rptr+=cplen;
......
......@@ -540,7 +540,7 @@ float ms_ticker_get_average_load(MSTicker *ticker){
once=TRUE;
}
#endif
return ticker->av_load;
return (float)ticker->av_load;
}
......
......@@ -367,7 +367,7 @@ static int ms_dtls_srtp_rtp_sendData (void *ctx, const unsigned char *data, size
rtp_session_get_transports(session,&rtpt,NULL);
/* generate message from raw data */
msg = rtp_session_create_packet_raw((uint8_t *)data, (int)length);
msg = rtp_session_create_packet_raw((uint8_t *)data, length);
ret = meta_rtp_transport_modifier_inject_packet(rtpt, context->rtp_modifier, msg , 0);
......@@ -402,7 +402,7 @@ static int ms_dtls_srtp_rtcp_sendData (void *ctx, const unsigned char *data, siz
rtp_session_get_transports(session,NULL,&rtcpt);
/* generate message from raw data */
msg = rtp_session_create_packet_raw((uint8_t *)data, (int)length);
msg = rtp_session_create_packet_raw((uint8_t *)data, length);
ret = meta_rtp_transport_modifier_inject_packet(rtcpt, context->rtcp_modifier, msg , 0);
freemsg(msg);
......
......@@ -107,7 +107,7 @@ static int _process_on_send(RtpSession* session,MSSrtpStreamContext *ctx, mblk_t
bool_t is_rtp=ctx->is_rtp;
rtp_header_t *rtp_header=is_rtp?(rtp_header_t*)m->b_rptr:NULL;
rtcp_common_header_t *rtcp_header=!is_rtp?(rtcp_common_header_t*)m->b_rptr:NULL;
slen=msgdsize(m);
slen=(int)msgdsize(m);
if (rtp_header && (slen>RTP_FIXED_HEADER_SIZE && rtp_header->version==2)) {
ms_mutex_lock(&ctx->mutex);
......@@ -151,7 +151,7 @@ static int ms_srtp_process_on_send(RtpTransportModifier *t, mblk_t *m){
}
static int ms_srtp_process_dummy(RtpTransportModifier *t, mblk_t *m) {
return msgdsize(m);
return (int)msgdsize(m);
}
static int _process_on_receive(RtpSession* session,MSSrtpStreamContext *ctx, mblk_t *m, int err){
int slen;
......@@ -179,7 +179,7 @@ static int _process_on_receive(RtpSession* session,MSSrtpStreamContext *ctx, mbl
}
}
static int ms_srtp_process_on_receive(RtpTransportModifier *t, mblk_t *m){
return _process_on_receive(t->session,(MSSrtpStreamContext*)t->data, m,msgdsize(m));
return _process_on_receive(t->session,(MSSrtpStreamContext*)t->data, m,(int)msgdsize(m));
}
/**** Session management functions ****/
......
......@@ -175,7 +175,7 @@ static int sender_unmute(MSFilter * f, void *arg)
static int sender_set_relay_session_id(MSFilter *f, void*arg){
SenderData *d = (SenderData *) f->data;
const char *tmp=(const char *)arg;
d->relay_session_id_size=b64_decode(tmp, strlen(tmp), (void*)d->relay_session_id, (unsigned int)sizeof(d->relay_session_id));
d->relay_session_id_size=(int)b64_decode(tmp, strlen(tmp), (void*)d->relay_session_id, (unsigned int)sizeof(d->relay_session_id));
return 0;
}
......@@ -230,7 +230,7 @@ static uint32_t get_cur_timestamp(MSFilter * f, mblk_t *im){
d->tsoff = curts - packet_ts;
}else{
diffts=packet_ts-d->last_ts;
difftime_ts=((f->ticker->time-d->last_sent_time)*d->rate)/1000;
difftime_ts=(int)(((f->ticker->time-d->last_sent_time)*d->rate)/1000);
/* detect timestamp jump in the stream and adjust so that they become continuous on the network*/
if (abs(diffts-difftime_ts)>(d->rate/5)){
uint32_t tsoff=curts - packet_ts;
......
......@@ -142,7 +142,7 @@ struct kiss_fft_state{
#else
# define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase)
# define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase)
# define HALF_OF(x) ((x)*.5)
# define HALF_OF(x) ((x)*.5f)
#endif
#define kf_cexp(x,phase) \
......
......@@ -157,7 +157,7 @@ static int compute_cross_correlation(int16_t *s1, int n1, int16_t *s2_padded, fl
for (i=0; i<xcorr_nsamples; i++){
norm2 += s2_padded[step*(i+n1-1)]*s2_padded[step*(i+n1-1)];
tmp = scalar_product(s1, s2_padded + i*step, n1, step);
xcorr[i] = (double)tmp / sqrt((double)(norm1)*(double)norm2);
xcorr[i] = (float)((double)tmp / sqrt((double)(norm1)*(double)norm2));
tmp = tmp < 0 ? -tmp : tmp;
if (tmp > max){
max = tmp;
......@@ -264,7 +264,7 @@ static int _ms_audio_diff_chunked(FileInfo *fi1, FileInfo *fi2, double *ret, int
num_chunks = i;
ms_message("tot_energy is %li", (long int) tot_energy);
maxpos = cum_maxpos / tot_energy;
maxpos = (int)(cum_maxpos / tot_energy);
ms_message("Maxpos is %i", maxpos);
/*compute variance of max_pos among all chunks*/
......
......@@ -376,7 +376,7 @@ void ms_fft(void *table, ms_word16_t *in, ms_word16_t *out)
int i;
float scale;
struct kiss_config *t = (struct kiss_config *)table;
scale = 1./t->N;
scale = 1.f/t->N;
kiss_fftr2(t->forward, in, out);
for (i=0;i<t->N;i++)
out[i] *= scale;
......
......@@ -306,7 +306,7 @@ static void kf_bfly_generic(
int twidx=0;
Fout[ k ] = scratchbuf[0];
for (q=1;q<p;++q ) {
twidx += fstride * k;
twidx += (int)(fstride * k);
if (twidx>=Norig) twidx-=Norig;
C_MUL(t,scratchbuf[q] , twiddles[twidx] );
C_ADDTO( Fout[ k ] ,t);
......@@ -411,7 +411,7 @@ void kf_work(
}
}*/
}else{
kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, fstride*in_stride, m);
kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, (int)(fstride*in_stride), m);
}
......
......@@ -66,7 +66,7 @@ static void plane_draw(uint8_t *p, int w, int h, int lsz, int index, int color1,
int i,j;
for(i=0;i<h;++i){
int tmp = index + (cos(4*(double)(i)/(double)h) * (w/8));
int tmp = index + (int)(cos(4*(double)(i)/(double)h) * (w/8));
for(j=0;j<w;++j){
p[j]= (( ((i+tmp)/85) + ((j+tmp)/85) ) & 0x1) ? color1 : color2;
}
......
......@@ -160,7 +160,7 @@ static void enc_preprocess(MSFilter *f) {
ms_error("Failed to get config: %s", vpx_codec_err_to_string(res));
return;
}
s->cfg.rc_target_bitrate = ((float)s->vconf.required_bitrate) * 0.92 / 1024.0; //0.9=take into account IP/UDP/RTP overhead, in average.
s->cfg.rc_target_bitrate = (unsigned int)(((float)s->vconf.required_bitrate) * 0.92f / 1024.0f); //0.92=take into account IP/UDP/RTP overhead, in average.
s->cfg.g_pass = VPX_RC_ONE_PASS; /* -p 1 */
s->cfg.g_timebase.num = 1;
s->cfg.g_timebase.den = (int)s->vconf.fps;
......@@ -427,7 +427,7 @@ static bool_t is_frame_independent(unsigned int flags){
static void enc_process(MSFilter *f) {
mblk_t *im;
uint64_t timems = f->ticker->time;
uint32_t timestamp = timems*90;
uint32_t timestamp = (uint32_t)(timems*90);
EncState *s = (EncState *)f->data;
unsigned int flags = 0;
vpx_codec_err_t err;
......@@ -581,7 +581,7 @@ static int enc_set_configuration(MSFilter *f, void *data) {
if (s->vconf.required_bitrate > s->vconf.bitrate_limit)
s->vconf.required_bitrate = s->vconf.bitrate_limit;
s->cfg.rc_target_bitrate = ((float)s->vconf.required_bitrate) * 0.92 / 1024.0; //0.9=take into account IP/UDP/RTP overhead, in average.
s->cfg.rc_target_bitrate = (unsigned int)(((float)s->vconf.required_bitrate) * 0.92f / 1024.0f); //0.92=take into account IP/UDP/RTP overhead, in average.
if (s->ready) {
ms_filter_lock(f);
enc_postprocess(f);
......@@ -950,7 +950,7 @@ static void dec_process(MSFilter *f) {
/* Decode unpacked VP8 frames. */
while (vp8rtpfmt_unpacker_get_frame(&s->unpacker, &frame, &frame_info) == 0) {
while ((im = ms_queue_get(&frame)) != NULL) {
err = vpx_codec_decode(&s->codec, im->b_rptr, im->b_wptr - im->b_rptr, NULL, 0);
err = vpx_codec_decode(&s->codec, im->b_rptr, (unsigned int)(im->b_wptr - im->b_rptr), NULL, 0);
if ((s->flags & VPX_CODEC_USE_INPUT_FRAGMENTS) && mblk_get_marker_info(im)) {
err = vpx_codec_decode(&s->codec, NULL, 0, NULL, 0);
}
......@@ -993,7 +993,7 @@ static void dec_process(MSFilter *f) {
}
ms_queue_put(f->outputs[0], dupmsg(s->yuv_msg));
if (ms_average_fps_update(&s->fps, f->ticker->time)) {
if (ms_average_fps_update(&s->fps, (uint32_t)f->ticker->time)) {
ms_message("VP8 decoder: Frame size: %dx%d", s->yuv_width, s->yuv_height);
}
if (!s->first_image_decoded) {
......
......@@ -367,8 +367,8 @@ static float audio_stream_get_rtcp_xr_average_lq_quality_rating(void *userdata)
}
static bool_t ci_ends_with(const char *filename, const char*suffix){
int filename_len=strlen(filename);
int