Commit a2ed4392 authored by Ghislain MARY's avatar Ghislain MARY

Fix warnings when building with Visual Studio.

parent d134dae1
......@@ -526,12 +526,12 @@ typedef struct OrtpLossRateEstimator{
* Total number of outgoing duplicate packets on last
* ortp_loss_rate_estimator_process_report_block iteration.
**/
int32_t last_dup_packet_sent_count;
int64_t last_dup_packet_sent_count;
/**
* Total number of outgoing unique packets on last
* ortp_loss_rate_estimator_process_report_block iteration.
**/
int32_t last_packet_sent_count;
int64_t last_packet_sent_count;
}OrtpLossRateEstimator;
......
......@@ -73,8 +73,8 @@ typedef struct _JitterControl
int adapt_jitt_comp_ts;
int64_t slide;
int64_t prev_slide;
int64_t olddiff;
float jitter;
int olddiff;
float inter_jitter; /* interarrival jitter as defined in the RFC */
int corrective_step;
int corrective_slide;
......
......@@ -78,7 +78,7 @@ void jitter_control_dump_stats(JitterControl *ctl){
to recv timestamp to make them reflect the instant they are delivered by the jitter buffer. */
void jitter_control_update_corrective_slide(JitterControl *ctl){
int tmp;
tmp=(int)(ctl->slide)-ctl->prev_slide;
tmp=(int)(ctl->slide-ctl->prev_slide);
if (tmp>ctl->corrective_step) {
ctl->corrective_slide+=ctl->corrective_step;
ctl->prev_slide=ctl->slide+ctl->corrective_step;
......@@ -114,7 +114,8 @@ void jitter_control_new_packet(JitterControl *ctl, uint32_t packet_ts, uint32_t
int d;
//printf("diff=%g\n",diff);
if (ctl->count==0){
slide=ctl->slide=ctl->prev_slide=diff;
ctl->slide=ctl->prev_slide=diff;
slide=(double)diff;
ctl->olddiff=diff;
ctl->jitter=0;
}else{
......@@ -123,7 +124,7 @@ void jitter_control_new_packet(JitterControl *ctl, uint32_t packet_ts, uint32_t
gap=(double)diff - slide;
gap=gap<0 ? -gap : 0; /*compute only for late packets*/
ctl->jitter=(float) ((ctl->jitter*(1-JC_GAMMA)) + (gap*JC_GAMMA));
d=diff-ctl->olddiff;
d=(int)(diff-ctl->olddiff);
ctl->inter_jitter=(float) (ctl->inter_jitter+ (( (float)abs(d) - ctl->inter_jitter)*(1/16.0)));
ctl->olddiff=diff;
ctl->count++;
......@@ -133,7 +134,7 @@ void jitter_control_new_packet(JitterControl *ctl, uint32_t packet_ts, uint32_t
//jitter_control_dump_stats(ctl);
}
ctl->slide=slide;
ctl->slide=(int64_t)slide;
}else {
/*ctl->slide and jitter size are not updated*/
}
......@@ -145,7 +146,7 @@ float jitter_control_compute_mean_size(JitterControl *ctl){
double tmp=((double)ctl->cum_jitter_buffer_size)/(double)ctl->cum_jitter_buffer_count;
ctl->cum_jitter_buffer_size=0;
ctl->cum_jitter_buffer_count=0;
return 1000.0*(float)tmp/(float)ctl->clock_rate;
return 1000.0f*(float)tmp/(float)ctl->clock_rate;
}
return 0;
}
......
......@@ -153,7 +153,7 @@ void rtp_session_enable_network_simulation(RtpSession *session, const OrtpNetwor
sim->params.max_bandwidth);
}
if (sim->params.max_bandwidth && sim->params.max_buffer_size==0) {
sim->params.max_buffer_size=sim->params.max_bandwidth;
sim->params.max_buffer_size=(int)sim->params.max_bandwidth;
ortp_message("Network simulation: Max buffer size not set for RTP session [%p], using [%i]",session,sim->params.max_buffer_size);
}
session->net_sim_ctx=sim;
......@@ -233,13 +233,13 @@ static int simulate_jitter_by_bit_budget_reduction(OrtpNetworkSimulatorCtx *sim,
threshold=100;
score=(float)r;
}else{
score=1000.0*(float)r*(now-sim->last_jitter_event)*sim->params.jitter_burst_density*1e-6;
score=1000.0f*(float)r*(now-sim->last_jitter_event)*sim->params.jitter_burst_density*1e-6f;
threshold=500;
}
if (score>(int)threshold){
int64_t strength_rand=sim->params.jitter_strength * (float)(ortp_random()%1000);
int64_t strength_rand=(int64_t)(sim->params.jitter_strength * (float)(ortp_random()%1000));
sim->in_jitter_event=TRUE;
budget_adjust=-((int64_t)budget_increase*strength_rand/1000LL);
budget_adjust=(int)-((int64_t)budget_increase*strength_rand/1000LL);
/*ortp_message("jitter in progress... bit_budget_adjustement=%i, bit_budget=%i",budget_adjust,sim->bit_budget);*/
}else if (sim->in_jitter_event){
/*ortp_message("jitter ended.");*/
......@@ -266,7 +266,7 @@ static mblk_t *simulate_bandwidth_limit_and_jitter(RtpSession *session, mblk_t *
}
/*update the budget */
elapsed=elapsed_us(&sim->last_check,&current);
budget_increase=(elapsed*(int64_t)sim->params.max_bandwidth)/1000000LL;
budget_increase=(int)((elapsed*(int64_t)sim->params.max_bandwidth)/1000000LL);
sim->bit_budget+=budget_increase;
sim->bit_budget+=simulate_jitter_by_bit_budget_reduction(sim,budget_increase);
sim->last_check=current;
......@@ -308,11 +308,11 @@ static mblk_t *simulate_bandwidth_limit_and_jitter(RtpSession *session, mblk_t *
static mblk_t *simulate_loss_rate(OrtpNetworkSimulatorCtx *net_sim_ctx, mblk_t *input){
int rrate;
float loss_rate=net_sim_ctx->params.loss_rate*10.0;
float loss_rate=net_sim_ctx->params.loss_rate*10.0f;
/*in order to simulate bursts of dropped packets, take into account a different probability after a loss occured*/
if (net_sim_ctx->consecutive_drops>0){
loss_rate=net_sim_ctx->params.consecutive_loss_probability*1000.0;
loss_rate=net_sim_ctx->params.consecutive_loss_probability*1000.0f;
}
rrate = ortp_random() % 1000;
......@@ -320,7 +320,7 @@ static mblk_t *simulate_loss_rate(OrtpNetworkSimulatorCtx *net_sim_ctx, mblk_t *
if (rrate >= loss_rate) {
if (net_sim_ctx->consecutive_drops){
/*after a burst of lost packets*/
net_sim_ctx->drops_to_ignore=net_sim_ctx->consecutive_drops - ((net_sim_ctx->consecutive_drops*net_sim_ctx->params.loss_rate)/100);
net_sim_ctx->drops_to_ignore=net_sim_ctx->consecutive_drops - (int)(((float)net_sim_ctx->consecutive_drops*net_sim_ctx->params.loss_rate)/100.0f);
net_sim_ctx->consecutive_drops=0;
}
return input;
......
......@@ -223,11 +223,11 @@ static void sender_info_init(sender_info_t *info, RtpSession *session){
info->rtp_timestamp=htonl(session->rtp.snd_last_ts);
info->senders_packet_count=(uint32_t) htonl((u_long) session->stats.packet_sent);
info->senders_octet_count=(uint32_t) htonl((u_long) session->rtp.sent_payload_bytes);
session->rtp.last_rtcp_packet_count=session->stats.packet_sent;
session->rtp.last_rtcp_packet_count=(uint32_t)session->stats.packet_sent;
}
static void report_block_init(report_block_t *b, RtpSession *session){
int packet_loss=0;
int64_t packet_loss=0;
int loss_fraction=0;
RtpStream *stream=&session->rtp;
uint32_t delay_snc_last_sr=0;
......@@ -321,7 +321,7 @@ static void report_block_init(report_block_t *b, RtpSession *session){
static void extended_statistics( RtpSession *session, report_block_t * rb ) {
/* the jitter raw value is kept in stream clock units */
uint32_t jitter = session->rtp.jittctl.inter_jitter;
uint32_t jitter = (uint32_t)session->rtp.jittctl.inter_jitter;
session->stats.sent_rtcp_packets ++;
session->rtp.jitter_stats.sum_jitter += jitter;
session->rtp.jitter_stats.jitter=jitter;
......@@ -449,7 +449,7 @@ static void rtp_session_create_and_send_rtcp_packet(RtpSession *session, bool_t
if (session->rtp.last_rtcp_packet_count < session->stats.packet_sent) {
m = make_sr(session);
session->rtp.last_rtcp_packet_count = session->stats.packet_sent;
session->rtp.last_rtcp_packet_count = (uint32_t)session->stats.packet_sent;
is_sr = TRUE;
} else if (session->stats.packet_recv > 0) {
/* Don't send RR when no packet are received yet */
......@@ -687,8 +687,8 @@ void ortp_loss_rate_estimator_init(OrtpLossRateEstimator *obj, int min_packet_co
bool_t ortp_loss_rate_estimator_process_report_block(OrtpLossRateEstimator *obj, const RtpSession *session, const report_block_t *rb){
int32_t cum_loss=report_block_get_cum_packet_lost(rb);
int32_t extseq=report_block_get_high_ext_seq(rb);
int32_t diff_unique_outgoing=session->stats.packet_sent-obj->last_packet_sent_count;
int32_t diff_total_outgoing=diff_unique_outgoing+session->stats.packet_dup_sent-obj->last_dup_packet_sent_count;
int32_t diff_unique_outgoing=(int32_t)(session->stats.packet_sent-obj->last_packet_sent_count);
int32_t diff_total_outgoing=diff_unique_outgoing+(int32_t)(session->stats.packet_dup_sent-obj->last_dup_packet_sent_count);
int32_t diff;
uint64_t curtime;
bool_t got_value=FALSE;
......
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