Commit f7861fa0 authored by Yann Diorcet's avatar Yann Diorcet

Implement lossrate

parent 21b8cec3
......@@ -109,9 +109,19 @@ static mblk_t *simulate_bandwidth_limit(RtpSession *session, mblk_t *input){
return output;
}
static mblk_t *simulate_loss_rate(RtpSession *session, mblk_t *input, int rate){
if((rand() % 101) >= rate) {
return input;
}
return NULL;
}
mblk_t * rtp_session_network_simulate(RtpSession *session, mblk_t *input){
OrtpNetworkSimulatorCtx *sim=session->net_sim_ctx;
mblk_t *om=NULL;
if (sim->params.loss_rate>0){
om=simulate_loss_rate(session,input, sim->params.loss_rate);
}
if (sim->params.max_bandwidth>0){
om=simulate_bandwidth_limit(session,input);
}
......
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