mblk_t * rtp_session_network_simulate(RtpSession *session, mblk_t *input, bool_t *is_rtp_packet){ OrtpNetworkSimulatorCtx *sim=session->net_sim_ctx; mblk_t *om=NULL; om=input; /*while packet is stored in network simulator queue, keep its type in reserved1 space*/ if (om != NULL){ sim->total_count++; om->reserved1 = *is_rtp_packet; } if (sim->params.latency>0){ om=simulate_latency(session,om); } if (sim->params.max_bandwidth>0){ om=simulate_bandwidth_limit_and_jitter(session,om); } if (sim->params.loss_rate>0 && om){ om=simulate_loss_rate(sim,om); } /*finally when releasing the packet from the simulator, reset the reserved1 space to default, since it will be used by mediastreamer later*/ if (om != NULL){ *is_rtp_packet = om->reserved1; om->reserved1 = 0; } return om; }
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); } return om; }