Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
972ab232
Commit
972ab232
authored
May 21, 2014
by
Gautier Pelloux-Prayer
Browse files
remove points older than 60sec from the MSList when maximum capacity is reached to reduce list size
parent
ae04a161
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
src/voip/qosanalyzer.c
src/voip/qosanalyzer.c
+12
-5
src/voip/qosanalyzer.h
src/voip/qosanalyzer.h
+2
-3
No files found.
src/voip/qosanalyzer.c
View file @
972ab232
...
...
@@ -233,6 +233,9 @@ static bool_t stateful_rt_prop_increased(MSStatefulQosAnalyser *obj){
return
FALSE
;
}
static
int
earlier_than
(
const
rtcpstatspoint_t
*
p
,
const
time_t
*
now
){
return
p
->
timestamp
>
*
now
;
}
static
int
sort_points
(
const
rtcpstatspoint_t
*
p1
,
const
rtcpstatspoint_t
*
p2
){
return
p1
->
bandwidth
>
p2
->
bandwidth
;
}
...
...
@@ -268,18 +271,22 @@ static bool_t stateful_analyser_process_rtcp(MSQosAnalyser *objbase, mblk_t *rtc
P
(
YELLOW
"SKIPPED first MIN burst %d: %f %f
\n
"
,
obj
->
curindex
-
1
,
rtp_session_get_send_bandwidth
(
obj
->
session
)
/
1000
.
0
,
cur
->
lost_percentage
/
100
.
0
);
}
else
{
obj
->
latest
=
ms_new0
(
rtcpstatspoint_t
,
1
);
obj
->
latest
->
timestamp
=
time
(
0
);
obj
->
latest
->
bandwidth
=
rtp_session_get_send_bandwidth
(
obj
->
session
)
/
1000
.
0
;
P
(
RED
"%f vs %f
\n
"
,
(
obj
->
session
->
rtp
.
stats
.
sent
-
obj
->
last_sent_count
)
*
0
.
01
/
(
time
(
0
)
-
obj
->
last_timestamp
),
rtp_session_get_send_bandwidth
(
obj
->
session
)
/
1000
.
0
);
/*obj->latest->bandwidth=(obj->session->rtp.stats.sent - obj->last_sent_count)*.01/(time(0) - obj->last_timestamp);*/
obj
->
latest
->
loss_percent
=
cur
->
lost_percentage
/
100
.
0
;
obj
->
latest
->
rtt
=
cur
->
rt_prop
;
obj
->
last_timestamp
=
time
(
0
);
obj
->
last_sent_count
=
obj
->
session
->
rtp
.
stats
.
sent
;
obj
->
rtcpstatspoint
=
ms_list_insert_sorted
(
obj
->
rtcpstatspoint
,
obj
->
latest
,
(
MSCompareFunc
)
sort_points
);
P
(
YELLOW
"one more %d: %f %f
\n
"
,
obj
->
curindex
-
1
,
obj
->
latest
->
bandwidth
,
obj
->
latest
->
loss_percent
);
}
if
(
ms_list_size
(
obj
->
rtcpstatspoint
)
>
ESTIM_HISTORY
){
P
(
RED
"Reached list maximum capacity (count=%d)"
,
ms_list_size
(
obj
->
rtcpstatspoint
));
/*clean everything which occured 60sec or more ago*/
time_t
now
=
time
(
0
)
-
60
;
obj
->
rtcpstatspoint
=
ms_list_remove_custom
(
obj
->
rtcpstatspoint
,
(
MSCompareFunc
)
earlier_than
,
&
now
);
P
(
RED
"--> Cleaned list (count=%d)
\n
"
,
ms_list_size
(
obj
->
rtcpstatspoint
));
}
}
}
return
rb
!=
NULL
;
...
...
src/voip/qosanalyzer.h
View file @
972ab232
...
...
@@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern
"C"
{
#endif
#define STATS_HISTORY 3
#define ESTIM_HISTORY 30
static
const
float
unacceptable_loss_rate
=
10
;
static
const
int
big_jitter
=
10
;
/*ms */
static
const
float
significant_delay
=
0
.
2
;
/*seconds*/
...
...
@@ -52,7 +53,7 @@ extern "C" {
}
MSSimpleQosAnalyser
;
typedef
struct
rtcpstatspoint
{
uint64
_t
timestamp
;
time
_t
timestamp
;
double
bandwidth
;
double
loss_percent
;
double
rtt
;
...
...
@@ -73,8 +74,6 @@ extern "C" {
rtcpstatspoint_t
*
latest
;
double
network_loss_rate
;
double
congestion_bandwidth
;
uint64_t
last_sent_count
;
uint64_t
last_timestamp
;
}
MSStatefulQosAnalyser
;
#ifdef __cplusplus
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment