free qos stateful alloced objects on destroy

parent 8b609943
......@@ -227,8 +227,12 @@ const char *ms_qos_analyser_network_state_name(MSQosAnalyserNetworkState state){
return "bad state type";
}
static int earlier_than(const rtcpstatspoint_t *p, const time_t * now){
return p->timestamp > *now;
static int earlier_than(rtcpstatspoint_t *p, const time_t * now){
if (p->timestamp < *now){
ms_free(p);
return FALSE;
}
return TRUE;
}
static int sort_points(const rtcpstatspoint_t *p1, const rtcpstatspoint_t *p2){
return p1->bandwidth > p2->bandwidth;
......@@ -541,11 +545,17 @@ static void stateful_analyser_update(MSQosAnalyser *objbase){
}
}
static void stateful_analyser_uninit(MSQosAnalyser *objbase){
MSStatefulQosAnalyser *obj=(MSStatefulQosAnalyser*)objbase;
ms_list_for_each(obj->rtcpstatspoint, ms_free);
}
static MSQosAnalyserDesc stateful_analyser_desc={
stateful_analyser_process_rtcp,
stateful_analyser_suggest_action,
stateful_analyser_has_improved,
stateful_analyser_update
stateful_analyser_update,
stateful_analyser_uninit,
};
MSQosAnalyser * ms_stateful_qos_analyser_new(RtpSession *session){
......
......@@ -462,7 +462,7 @@ static void adaptive_vp8() {
OrtpEvQueue * evq;
evq=start_adaptive_stream(VideoStreamType, &marielle, &margaux, VP8_PAYLOAD_TYPE, 300000, 0, 25, 50, 0);
iterate_adaptive_stream(marielle, margaux, evq, timeout_receive_rtcp(13), NULL, 0);
iterate_adaptive_stream(marielle, margaux, evq, timeout_receive_rtcp(18), NULL, 0);
CU_ASSERT_IN_RANGE(marielle->video_stats.loss_estim, 20, 30);
CU_ASSERT_TRUE(marielle->video_stats.congestion_bw_estim > 200);
DEINIT();
......@@ -470,19 +470,19 @@ static void adaptive_vp8() {
/*very low bandwidth cause a lot of packets to be dropped since congestion is
always present even if we are below the limit due to encoding variance*/
evq=start_adaptive_stream(VideoStreamType, &marielle, &margaux, VP8_PAYLOAD_TYPE, 300000, 40000, 0, 50,0);
iterate_adaptive_stream(marielle, margaux, evq, timeout_receive_rtcp(13), NULL, 0);
iterate_adaptive_stream(marielle, margaux, evq, timeout_receive_rtcp(18), NULL, 0);
CU_ASSERT_IN_RANGE(marielle->video_stats.loss_estim, 0, 15);
CU_ASSERT_IN_RANGE(marielle->video_stats.congestion_bw_estim, 20, 65);
DEINIT();
evq=start_adaptive_stream(VideoStreamType, &marielle, &margaux, VP8_PAYLOAD_TYPE, 300000, 70000,0, 50,0);
iterate_adaptive_stream(marielle, margaux, evq, timeout_receive_rtcp(13), NULL, 0);
iterate_adaptive_stream(marielle, margaux, evq, timeout_receive_rtcp(18), NULL, 0);
CU_ASSERT_IN_RANGE(marielle->video_stats.loss_estim, 0, 10);
CU_ASSERT_IN_RANGE(marielle->video_stats.congestion_bw_estim, 50, 95);
DEINIT();
evq=start_adaptive_stream(VideoStreamType, &marielle, &margaux, VP8_PAYLOAD_TYPE, 300000, 100000,15, 50,0);
iterate_adaptive_stream(marielle, margaux, evq, timeout_receive_rtcp(13), NULL, 0);
iterate_adaptive_stream(marielle, margaux, evq, timeout_receive_rtcp(18), NULL, 0);
CU_ASSERT_IN_RANGE(marielle->video_stats.loss_estim, 10, 20);
CU_ASSERT_IN_RANGE(marielle->video_stats.congestion_bw_estim, 80, 125);
DEINIT();
......
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