Commit 31d242e8 authored by Simon Morlat's avatar Simon Morlat

fix bug and leak in network simulator

parent dbb75fb0
......@@ -113,18 +113,21 @@ static mblk_t *simulate_loss_rate(RtpSession *session, mblk_t *input, int rate){
if((rand() % 101) >= rate) {
return input;
}
freemsg(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);
}
om=input;
if (sim->params.max_bandwidth>0){
om=simulate_bandwidth_limit(session,input);
}
if (sim->params.loss_rate>0 && om){
om=simulate_loss_rate(session,om, sim->params.loss_rate);
}
return om;
}
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