Commit 15c79d12 authored by Sandrine Avakian's avatar Sandrine Avakian

Added the possibility in network simulator to randomly lose only RTP packets...

Added the possibility in network simulator to randomly lose only RTP packets (instead of RTP and RTCP).
parent 7f7cd314
......@@ -143,6 +143,7 @@ typedef struct _OrtpNetworkSimulatorParams{
float consecutive_loss_probability;/**< a probablity of having a subsequent loss after a loss occured, in a 0-1 range. Useful to simulate burst of lost packets*/
float jitter_burst_density; /**<density of gap/bursts events. A value of 1 means one gap/burst per second approximately*/
float jitter_strength; /**<percentage of max_bandwidth artifically consumed during bursts events*/
bool_t RTP_only; /**True for only RTP packet loss, False for both RTP and RTCP */
OrtpNetworkSimulatorMode mode; /**<whether simulation is applied to inboud or outbound stream.*/
}OrtpNetworkSimulatorParams;
......
......@@ -182,6 +182,7 @@ void rtp_session_enable_network_simulation(RtpSession *session, const OrtpNetwor
);
}else{
session->net_sim_ctx=NULL;
ortp_message("rtp_session_enable_network_simulation:DISABLING NETWORK SIMULATION");
if (sim!=NULL) ortp_network_simulator_destroy(sim);
}
}
......@@ -342,7 +343,7 @@ mblk_t * rtp_session_network_simulate(RtpSession *session, mblk_t *input, bool_t
om=input;
/*while packet is stored in network simulator queue, keep its type in reserved1 space*/
/*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;
......@@ -355,7 +356,8 @@ mblk_t * rtp_session_network_simulate(RtpSession *session, mblk_t *input, bool_t
if (sim->params.max_bandwidth>0){
om=simulate_bandwidth_limit_and_jitter(session,om);
}
if (sim->params.loss_rate>0 && om){
if (sim->params.loss_rate>0 && om && (*is_rtp_packet == TRUE) && (sim->params.RTP_only==TRUE) ){
om=simulate_loss_rate(sim,om);
}
/*finally when releasing the packet from the simulator, reset the reserved1 space to default,
......
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