Commit dd51efd2 authored by Simon Morlat's avatar Simon Morlat

fix warnings for windows build

parent 4b85949a
......@@ -26,8 +26,6 @@
static const unsigned int congestion_pending_duration_ms = 5000;
static int congestion_count = 0;
void ortp_congestion_detector_reset(OrtpCongestionDetector *cd) {
if (cd->state!=CongestionStateNormal) {
......@@ -44,7 +42,7 @@ OrtpCongestionDetector * ortp_congestion_detector_new(RtpSession *session) {
ortp_congestion_detector_reset(cd);
cd->initialized = FALSE;
cd->session = session;
// congestion_count = 0;
return cd;
}
......@@ -58,7 +56,7 @@ bool_t ortp_congestion_detector_record(OrtpCongestionDetector *cd, uint32_t pack
if (!cd->initialized) {
cd->initialized = TRUE;
ortp_kalman_rls_init(&cd->rls, 1, diff);
ortp_kalman_rls_init(&cd->rls, 1, (double)diff);
cd->rls.lambda = 0.95f;
}
......@@ -69,14 +67,14 @@ bool_t ortp_congestion_detector_record(OrtpCongestionDetector *cd, uint32_t pack
has_jitter = jitter > 300.f;
ortp_debug(
"%s clock=%f, congestion_count=%d"
"%s clock=%f"
", diff=%ld"
", %f >? 300.f"
", clock_rate=%d"
", jb_slide=%f, jb_clock=%f"
", down_bw=%0.f, up_bw=%0.f kbits/s"
, cd->state==CongestionStateNormal?"":cd->state==CongestionStatePending?"TO CONFIRM...":"IN CONGESTION!"
, cd->rls.m, congestion_count
, cd->rls.m
, (long)diff
, jitter
, jitterctl->clock_rate
......@@ -88,7 +86,7 @@ bool_t ortp_congestion_detector_record(OrtpCongestionDetector *cd, uint32_t pack
case CongestionStateNormal:
if (clock_drift) {
cd->start_ms = ortp_get_cur_time_ms();
cd->start_jitter_ts = jitterctl->kalman_rls.b;
cd->start_jitter_ts = (int64_t)jitterctl->kalman_rls.b;
ortp_message("Congestion detection starts current jitter=%f...", jitterctl->kalman_rls.b);
cd->state = CongestionStatePending;
state_changed = TRUE;
......@@ -103,7 +101,6 @@ bool_t ortp_congestion_detector_record(OrtpCongestionDetector *cd, uint32_t pack
if (ortp_get_cur_time_ms() - cd->start_ms > congestion_pending_duration_ms) {
ortp_warning("In congestion for more than %d seconds, trigger flag!", congestion_pending_duration_ms / 1000);
cd->state = CongestionStateDetected;
congestion_count++;
state_changed = TRUE;
}
}
......
......@@ -188,7 +188,7 @@ void jitter_control_new_packet(JitterControl *ctl, uint32_t packet_ts, uint32_t
static void jitter_control_update_interarrival_jitter(JitterControl *ctl, int64_t diff){
/*compute interarrival jitter*/
int delta;
delta=diff-ctl->olddiff;
delta= (int)(diff-ctl->olddiff);
ctl->inter_jitter=(float) (ctl->inter_jitter+ (( (float)abs(delta) - ctl->inter_jitter)*(1/16.0)));
ctl->olddiff=diff;
}
......@@ -198,7 +198,8 @@ void jitter_control_new_packet_basic(JitterControl *ctl, uint32_t packet_ts, uin
double gap,slide;
if (ctl->count==0){
slide=ctl->clock_offset_ts=ctl->prev_clock_offset_ts=diff;
ctl->clock_offset_ts=ctl->prev_clock_offset_ts=diff;
slide=(double)diff;
ctl->olddiff=diff;
ctl->jitter=0;
}else{
......@@ -214,8 +215,7 @@ void jitter_control_new_packet_basic(JitterControl *ctl, uint32_t packet_ts, uin
ctl->adapt_jitt_comp_ts=(int) MAX(ctl->jitt_comp_ts,2*ctl->jitter);
//jitter_control_dump_stats(ctl);
}
ctl->clock_offset_ts=slide;
ctl->clock_offset_ts=(int64_t)slide;
}else {
/*ctl->slide and jitter size are not updated*/
}
......@@ -237,7 +237,7 @@ static uint32_t jitter_control_local_ts_to_remote_ts_rls(JitterControl *ctl, uin
/**************************** RLS *********************************/
void jitter_control_new_packet_rls(JitterControl *ctl, uint32_t packet_ts, uint32_t cur_str_ts){
int64_t diff=(int64_t)packet_ts - (int64_t)cur_str_ts;
double deviation;
int deviation;
bool_t jb_size_updated = FALSE;
if (ctl->count==0){
......@@ -246,10 +246,10 @@ void jitter_control_new_packet_rls(JitterControl *ctl, uint32_t packet_ts, uint3
ctl->jitter=0;
ortp_extremum_init(&ctl->max_ts_deviation, ctl->params.refresh_ms / 1000.f * ctl->clock_rate);
ortp_extremum_record_max(&ctl->max_ts_deviation, cur_str_ts, ctl->jitt_comp_ts);
ortp_extremum_record_max(&ctl->max_ts_deviation, cur_str_ts, (float)ctl->jitt_comp_ts);
// clocks rate should be the same
ortp_kalman_rls_init(&ctl->kalman_rls, 1, diff);
ortp_kalman_rls_init(&ctl->kalman_rls, 1, (double)diff);
ctl->capped_clock_ratio = ctl->kalman_rls.m;
}
......@@ -258,19 +258,18 @@ void jitter_control_new_packet_rls(JitterControl *ctl, uint32_t packet_ts, uint3
ortp_kalman_rls_record(&ctl->kalman_rls, cur_str_ts, packet_ts);
ctl->capped_clock_ratio=MAX(.5, MIN(ctl->kalman_rls.m, 2));
ctl->clock_offset_ts = (!(.5f<ctl->kalman_rls.m && ctl->kalman_rls.m<2.f))? diff : ctl->kalman_rls.b;
ctl->clock_offset_ts = (!(.5f<ctl->kalman_rls.m && ctl->kalman_rls.m<2.f))? diff : (int64_t)ctl->kalman_rls.b;
deviation=abs((int32_t)(packet_ts - jitter_control_local_ts_to_remote_ts_rls(ctl, cur_str_ts)));
ctl->jitter=(float) ((ctl->jitter*(1-JC_GAMMA)) + (deviation*JC_GAMMA));
/*ortp_message("deviation=%g ms", 1000.0*deviation/(double)ctl->clock_rate);*/
jitter_control_update_interarrival_jitter(ctl, diff);
if (ctl->params.adaptive){
bool_t max_updated = ortp_extremum_record_max(&ctl->max_ts_deviation, cur_str_ts, deviation);
bool_t max_updated = ortp_extremum_record_max(&ctl->max_ts_deviation, cur_str_ts, (float)deviation);
float max_deviation = MAX(ortp_extremum_get_previous(&ctl->max_ts_deviation), ortp_extremum_get_current(&ctl->max_ts_deviation));
if (max_updated && max_deviation > ctl->adapt_jitt_comp_ts){
ctl->adapt_jitt_comp_ts=max_deviation;
ctl->adapt_jitt_comp_ts=(int)max_deviation;
jb_size_updated = TRUE;
}else if (max_deviation < ctl->params.ramp_threshold/100.f*ctl->adapt_jitt_comp_ts){
/*Jitter is decreasing. Make a smooth descent to avoid dropping lot of packets*/
......@@ -300,7 +299,7 @@ void jitter_control_new_packet_rls(JitterControl *ctl, uint32_t packet_ts, uint3
", offset=%g clock_ratio=%g"
", capped_offset=%i capped_clock_ratio=%f"
", max_ts_deviation=%f prev_max_ts_deviation=%f"
", deviation=%f"
", deviation=%i"
", RLS VARIABLES: P[0][0]=%f, P[1][0]=%f, P[0][1]=%f, P[1][1]=%f"
, ctl->count
, ctl->kalman_rls.b, ctl->kalman_rls.m
......
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