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
6bc86a53
Commit
6bc86a53
authored
May 27, 2014
by
Gautier Pelloux-Prayer
Browse files
add unit test for bandwidth computation algorithm
parent
97f3c612
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
src/voip/qosanalyzer.c
src/voip/qosanalyzer.c
+4
-4
tester/mediastreamer2_adaptive_tester.c
tester/mediastreamer2_adaptive_tester.c
+15
-1
tester/mediastreamer2_tester.c
tester/mediastreamer2_tester.c
+2
-1
No files found.
src/voip/qosanalyzer.c
View file @
6bc86a53
...
...
@@ -290,7 +290,7 @@ static bool_t stateful_analyser_process_rtcp(MSQosAnalyser *objbase, mblk_t *rtc
if
(
obj
->
last_seq
>
0
){
int
total_emitted
=
uniq_emitted
*
(
1
+
obj
->
session
->
duplication_ratio
);
printf
(
"RECEIVE cumloss=%d uniq_emitted=%d total_emitted=%d
\n
"
,
cum_loss_curr
,
uniq_emitted
,
total_emitted
);
loss_rate
=
100
*
(
1
.
-
(
uniq_emitted
-
cum_loss_curr
)
*
1
.
f
/
total_emitted
);
loss_rate
=
(
1
.
-
(
uniq_emitted
-
cum_loss_curr
)
*
1
.
f
/
total_emitted
);
/*printf("RECEIVE expec=%d - received=%d =%d --> cum_loss=%ld\n", expected_packets, stream->hwrcv_since_last_SR, packet_loss, stream->stats.cum_packet_loss);*/
printf
(
"RECEIVE estimated loss rate=%f vs 'real'=%f
\n
"
,
loss_rate
,
report_block_get_fraction_lost
(
rb
)
/
2
.
56
);
}
...
...
@@ -455,10 +455,11 @@ static void stateful_analyser_suggest_action(MSQosAnalyser *objbase, MSRateContr
/*rtp_session_set_duplication_ratio(obj->session, 0);*/
/*try a burst every 50 seconds (10 RTCP packets)*/
if
(
obj
->
curindex
>
10
){
if
(
obj
->
curindex
%
10
==
0
){
P
(
YELLOW
"try burst!
\n
"
);
/*bw *= 3;*/
rtp_session_set_duplication_ratio
(
obj
->
session
,
2
);
/*rtp_session_set_duplication_ratio(obj->session, 2);*/
obj
->
burst_state
=
MSStatefulQosAnalyserBurstEnable
;
}
/*test a min burst to avoid overestimation of available bandwidth*/
else
if
(
obj
->
curindex
%
10
==
5
||
obj
->
curindex
%
10
==
6
){
...
...
@@ -537,7 +538,6 @@ static bool_t stateful_analyser_has_improved(MSQosAnalyser *objbase){
static
void
stateful_analyser_update
(
MSQosAnalyser
*
objbase
){
MSStatefulQosAnalyser
*
obj
=
(
MSStatefulQosAnalyser
*
)
objbase
;
static
time_t
last_measure
;
if
(
last_measure
!=
ms_time
(
0
)){
...
...
tester/mediastreamer2_adaptive_tester.c
View file @
6bc86a53
...
...
@@ -416,9 +416,23 @@ static void upload_bandwidth_computation() {
if
(
supported
)
{
stream_manager_t
*
marielle
,
*
margaux
;
OrtpEvQueue
*
evq
;
int
i
;
const
MSQosAnalyser
*
analyser
;
double
cur_up_bw
;
evq
=
start_adaptive_stream
(
AudioStreamType
,
&
marielle
,
&
margaux
,
PCMA8_PAYLOAD_TYPE
,
8000
,
0
,
0
,
0
,
0
);
iterate_adaptive_stream
(
marielle
,
margaux
,
evq
,
10
,
&
marielle
->
audio_stats
.
number_of_EndOfFile
,
10
);
analyser
=
ms_bitrate_controller_get_qos_analyser
(
marielle
->
audio_stream
->
ms
.
rc
);
if
(
analyser
->
type
==
Stateful
){
const
MSStatefulQosAnalyser
*
stateful_analyser
=
((
const
MSStatefulQosAnalyser
*
)
analyser
);
for
(
i
=
0
;
i
<
5
;
i
++
){
rtp_session_set_duplication_ratio
(
marielle
->
audio_stream
->
ms
.
sessions
.
rtp_session
,
i
);
iterate_adaptive_stream
(
marielle
,
margaux
,
evq
,
2
,
NULL
,
0
);
cur_up_bw
=
stateful_analyser
->
interval_count
?
stateful_analyser
->
upload_bandwidth_sum
/
stateful_analyser
->
interval_count
:
0
;
/*since PCMA uses 80kbit/s, upload bandwidth should just be 80x(duplication_ratio+1) kbits/s */
CU_ASSERT_TRUE
(
fabs
(
cur_up_bw
-
80
.
*
(
i
+
1
))
<
1
.
f
);
}
}
DEINIT
();
}
}
...
...
tester/mediastreamer2_tester.c
View file @
6bc86a53
...
...
@@ -278,6 +278,8 @@ int main (int argc, char *argv[]) {
}
#endif
else
{
fprintf
(
stderr
,
"Unknown option
\"
%s
\"\n
"
,
argv
[
i
]);
\
helper
(
argv
[
0
]);
return
-
1
;
}
...
...
@@ -288,7 +290,6 @@ int main (int argc, char *argv[]) {
}
else
{
putenv
(
"MEDIASTREAMER_DEBUG=0"
);
}
ret
=
mediastreamer2_tester_run_tests
(
suite_name
,
test_name
);
mediastreamer2_tester_uninit
();
return
ret
;
...
...
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