Commit 4a4ecae9 authored by Ghislain MARY's avatar Ghislain MARY

Fix network simulator.

It was only dropping RTP packets if RTP_only had been set.
parent 15c79d12
......@@ -143,7 +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 */
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,7 +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");
ortp_message("rtp_session_enable_network_simulation:DISABLING NETWORK SIMULATION");
if (sim!=NULL) ortp_network_simulator_destroy(sim);
}
}
......@@ -343,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;
......@@ -356,10 +356,17 @@ 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 && (*is_rtp_packet == TRUE) && (sim->params.RTP_only==TRUE) ){
om=simulate_loss_rate(sim,om);
if ((sim->params.loss_rate > 0) && (om != NULL)) {
if (sim->params.RTP_only == TRUE) {
if (*is_rtp_packet == TRUE) {
om = simulate_loss_rate(sim, om);
}
} else {
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){
......
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