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
d02c0c3e
Commit
d02c0c3e
authored
Jun 02, 2014
by
Gautier Pelloux-Prayer
Browse files
use new bandwidth computation method and fix burst settings
parent
ca73e626
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
17 deletions
+13
-17
src/voip/qosanalyzer.c
src/voip/qosanalyzer.c
+6
-10
tester/mediastreamer2_adaptive_tester.c
tester/mediastreamer2_adaptive_tester.c
+7
-7
No files found.
src/voip/qosanalyzer.c
View file @
d02c0c3e
...
...
@@ -258,7 +258,7 @@ static double stateful_qos_analyser_upload_bandwidth(MSStatefulQosAnalyser *obj)
obj
->
upload_bandwidth_sum
=
0
;
P
(
GREEN
"latest_up_bw=%f vs sum_up_bw=%f
\n
"
,
up_bw
,
obj
->
upload_bandwidth_latest
);
return
up_bw
;
return
obj
->
upload_bandwidth_latest
;
}
static
bool_t
stateful_analyser_process_rtcp
(
MSQosAnalyser
*
objbase
,
mblk_t
*
rtcp
){
...
...
@@ -294,9 +294,8 @@ static bool_t stateful_analyser_process_rtcp(MSQosAnalyser *objbase, mblk_t *rtc
int
uniq_emitted
=
report_block_get_high_ext_seq
(
rb
)
-
obj
->
previous_ext_high_seq_num_rec
;
if
(
obj
->
previous_ext_high_seq_num_rec
>
0
){
printf
(
"RECEIVE cumloss=%d uniq_emitted=%d total_emitted=%d
\n
"
,
cum_loss_curr
,
uniq_emitted
,
total_emitted
);
loss_rate
=
(
1
.
-
(
uniq_emitted
-
cum_loss_curr
)
*
1
.
f
/
total_emitted
);
printf
(
"RECEIVE estimated loss rate=%f vs 'real'=%f
\n
"
,
loss_rate
,
report_block_get_fraction_lost
(
rb
)
/
2
.
56
);
printf
(
"RECEIVE estimated loss rate=%f vs 'real'=%f
\n
"
,
loss_rate
,
report_block_get_fraction_lost
(
rb
)
/
256
.
);
}
if
(
obj
->
curindex
%
10
==
6
){
...
...
@@ -460,12 +459,9 @@ static void stateful_analyser_suggest_action(MSQosAnalyser *objbase, MSRateContr
float
curbw
=
obj
->
latest
?
obj
->
latest
->
bandwidth
:
0
.
f
;
float
bw
=
compute_available_bw
(
obj
);
/*rtp_session_set_duplication_ratio(obj->session, 0);*/
/*try a burst every 50 seconds (10 RTCP packets)*/
if
(
obj
->
curindex
%
10
==
0
){
P
(
YELLOW
"try burst!
\n
"
);
/*bw *= 3;*/
/*rtp_session_set_duplication_ratio(obj->session, 2);*/
obj
->
burst_state
=
MSStatefulQosAnalyserBurstEnable
;
}
/*test a min burst to avoid overestimation of available bandwidth*/
...
...
@@ -473,7 +469,7 @@ static void stateful_analyser_suggest_action(MSQosAnalyser *objbase, MSRateContr
P
(
YELLOW
"try minimal burst!
\n
"
);
bw
*=
.
33
;
}
/*no
t
bandwidth estimation computed*/
/*no bandwidth estimation computed*/
if
(
bw
<=
0
){
action
->
type
=
MSRateControlActionDoNothing
;
action
->
value
=
0
;
...
...
@@ -524,7 +520,7 @@ static void stateful_analyser_update(MSQosAnalyser *objbase){
case
MSStatefulQosAnalyserBurstEnable
:{
obj
->
burst_state
=
MSStatefulQosAnalyserBurstInProgress
;
ortp_gettimeofday
(
&
obj
->
start_time
,
NULL
);
rtp_session_set_duplication_ratio
(
obj
->
session
,
2
);
rtp_session_set_duplication_ratio
(
obj
->
session
,
obj
->
burst_ratio
);
obj
->
start_seq_number
=
obj
->
last_seq_number
=
obj
->
session
->
rtp
.
snd_seq
;
}
case
MSStatefulQosAnalyserBurstInProgress
:
{
struct
timeval
now
;
...
...
@@ -535,7 +531,6 @@ static void stateful_analyser_update(MSQosAnalyser *objbase){
obj
->
last_seq_number
=
obj
->
session
->
rtp
.
snd_seq
;
/*burst should last 1sec*/
if
(
elapsed
>
obj
->
burst_duration_ms
){
obj
->
burst_state
=
MSStatefulQosAnalyserBurstDisable
;
rtp_session_set_duplication_ratio
(
obj
->
session
,
0
);
...
...
@@ -563,8 +558,9 @@ MSQosAnalyser * ms_stateful_qos_analyser_new(RtpSession *session){
obj
->
session
=
session
;
obj
->
parent
.
desc
=&
stateful_analyser_desc
;
obj
->
parent
.
type
=
Stateful
;
/*double the upload bandwidth based on a 5 sec RTCP reports interval*/
obj
->
burst_duration_ms
=
1000
;
obj
->
burst_ratio
=
2
;
obj
->
burst_ratio
=
9
;
return
(
MSQosAnalyser
*
)
obj
;
}
...
...
tester/mediastreamer2_adaptive_tester.c
View file @
d02c0c3e
...
...
@@ -349,26 +349,26 @@ static void adaptive_opus_audio_stream() {
// on EDGEBW, both should be overconsumming
evq
=
start_adaptive_stream
(
AudioStreamType
,
&
marielle
,
&
margaux
,
OPUS_PAYLOAD_TYPE
,
8000
,
EDGE_BW
,
0
,
0
,
0
);
iterate_adaptive_stream
(
marielle
,
margaux
,
evq
,
timeout_receive_rtcp
(
14
),
&
marielle
->
audio_stats
.
number_of_EndOfFile
,
10
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
)
*
1
.
/
EDGE_BW
;
CU_ASSERT_IN_RANGE
(
bw_usage
,
2
.
f
,
3
.
f
);
// bad! since this codec cant change its ptime and it is the lower bitrate, no improvement can occur
DEINIT
();
evq
=
start_adaptive_stream
(
AudioStreamType
,
&
marielle
,
&
margaux
,
OPUS_PAYLOAD_TYPE
,
48000
,
EDGE_BW
,
0
,
0
,
0
);
iterate_adaptive_stream
(
marielle
,
margaux
,
evq
,
timeout_receive_rtcp
(
11
),
&
marielle
->
audio_stats
.
number_of_EndOfFile
,
10
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
)
*
1
.
/
EDGE_BW
;
CU_ASSERT_IN_RANGE
(
bw_usage
,
1
.
f
,
1
.
4
f
);
// bad!
DEINIT
();
// on 3G BW, both should be at max
evq
=
start_adaptive_stream
(
AudioStreamType
,
&
marielle
,
&
margaux
,
OPUS_PAYLOAD_TYPE
,
8000
,
THIRDGENERATION_BW
,
0
,
0
,
0
);
iterate_adaptive_stream
(
marielle
,
margaux
,
evq
,
timeout_receive_rtcp
(
5
),
&
marielle
->
audio_stats
.
number_of_EndOfFile
,
10
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
)
*
1
.
/
THIRDGENERATION_BW
;
CU_ASSERT_IN_RANGE
(
bw_usage
,
.
1
f
,
.
15
f
);
DEINIT
();
evq
=
start_adaptive_stream
(
AudioStreamType
,
&
marielle
,
&
margaux
,
OPUS_PAYLOAD_TYPE
,
48000
,
THIRDGENERATION_BW
,
0
,
0
,
0
);
iterate_adaptive_stream
(
marielle
,
margaux
,
evq
,
timeout_receive_rtcp
(
5
),
&
marielle
->
audio_stats
.
number_of_EndOfFile
,
10
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
)
*
1
.
/
THIRDGENERATION_BW
;
CU_ASSERT_IN_RANGE
(
bw_usage
,
.
2
f
,
.
3
f
);
DEINIT
();
}
...
...
@@ -385,7 +385,7 @@ static void adaptive_speex16_audio_stream() {
evq
=
start_adaptive_stream
(
AudioStreamType
,
&
marielle
,
&
margaux
,
SPEEX16_PAYLOAD_TYPE
,
32000
,
EDGE_BW
/
2
.,
0
,
0
,
0
);
iterate_adaptive_stream
(
marielle
,
margaux
,
evq
,
timeout_receive_rtcp
(
10
),
&
marielle
->
audio_stats
.
number_of_EndOfFile
,
10
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
)
*
1
.
/
(
EDGE_BW
/
2
.)
;
CU_ASSERT_IN_RANGE
(
bw_usage
,
1
.
f
,
5
.
f
);
DEINIT
();
}
...
...
@@ -402,13 +402,13 @@ static void adaptive_pcma_audio_stream() {
// yet non-adaptative codecs cannot respect low throughput limitations
evq
=
start_adaptive_stream
(
AudioStreamType
,
&
marielle
,
&
margaux
,
PCMA8_PAYLOAD_TYPE
,
8000
,
EDGE_BW
,
0
,
0
,
0
);
iterate_adaptive_stream
(
marielle
,
margaux
,
evq
,
timeout_receive_rtcp
(
10
),
&
marielle
->
audio_stats
.
number_of_EndOfFile
,
10
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
)
*
1
.
/
EDGE_BW
;
CU_ASSERT_IN_RANGE
(
bw_usage
,
6
.
f
,
8
.
f
);
// this is bad!
DEINIT
();
evq
=
start_adaptive_stream
(
AudioStreamType
,
&
marielle
,
&
margaux
,
PCMA8_PAYLOAD_TYPE
,
8000
,
THIRDGENERATION_BW
,
0
,
0
,
0
);
iterate_adaptive_stream
(
marielle
,
margaux
,
evq
,
timeout_receive_rtcp
(
5
),
&
marielle
->
audio_stats
.
number_of_EndOfFile
,
10
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
);
bw_usage
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
)
*
1
.
/
THIRDGENERATION_BW
;
CU_ASSERT_IN_RANGE
(
bw_usage
,
.
3
f
,
.
5
f
);
DEINIT
();
}
...
...
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