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
liblinphone
Commits
a115491b
Commit
a115491b
authored
Nov 16, 2018
by
Ronan
Browse files
fix(call-single-tester): avoid out of bounds when call stats type is TEXT in call_stats_updated
parent
d2506c61
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
17 deletions
+24
-17
tester/call_single_tester.c
tester/call_single_tester.c
+24
-17
No files found.
tester/call_single_tester.c
View file @
a115491b
...
...
@@ -109,35 +109,42 @@ static void rtcp_received(stats* counters, mblk_t *packet) {
}
void
call_stats_updated
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
,
const
LinphoneCallStats
*
lstats
)
{
stats
*
counters
=
get_stats
(
lc
);
const
int
updated
=
_linphone_call_stats_get_updated
(
lstats
);
stats
*
counters
=
get_stats
(
lc
);
counters
->
number_of_LinphoneCallStatsUpdated
++
;
if
(
_linphone_call_stats_get_updated
(
lstats
)
&
LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE
)
{
if
(
updated
&
LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE
)
{
counters
->
number_of_rtcp_received
++
;
if
(
_linphone_call_stats_rtcp_received_via_mux
(
lstats
)){
counters
->
number_of_rtcp_received_via_mux
++
;
}
rtcp_received
(
counters
,
_linphone_call_stats_get_received_rtcp
(
lstats
));
}
if
(
_linphone_call_stats_get_updated
(
lstats
)
&
LINPHONE_CALL_STATS_SENT_RTCP_UPDATE
)
{
if
(
updated
&
LINPHONE_CALL_STATS_SENT_RTCP_UPDATE
)
{
counters
->
number_of_rtcp_sent
++
;
}
if
(
_linphone_call_stats_get_updated
(
lstats
)
&
LINPHONE_CALL_STATS_PERIODICAL_UPDATE
)
{
int
tab_size
=
sizeof
(
counters
->
audio_download_bandwidth
)
/
sizeof
(
int
);
int
index
=
(
counters
->
current_bandwidth_index
[
linphone_call_stats_get_type
(
lstats
)]
++
)
%
tab_size
;
LinphoneCallStats
*
audio_stats
,
*
video_stats
;
audio_stats
=
linphone_call_get_audio_stats
(
call
);
video_stats
=
linphone_call_get_video_stats
(
call
);
if
(
linphone_call_stats_get_type
(
lstats
)
==
LINPHONE_CALL_STATS_AUDIO
)
{
counters
->
audio_download_bandwidth
[
index
]
=
(
int
)
linphone_call_stats_get_download_bandwidth
(
audio_stats
);
counters
->
audio_upload_bandwidth
[
index
]
=
(
int
)
linphone_call_stats_get_upload_bandwidth
(
audio_stats
);
if
(
updated
&
LINPHONE_CALL_STATS_PERIODICAL_UPDATE
)
{
const
int
tab_size
=
sizeof
counters
->
audio_download_bandwidth
/
sizeof
(
int
);
LinphoneCallStats
*
call_stats
;
int
index
;
int
type
=
linphone_call_stats_get_type
(
lstats
);
if
(
type
!=
LINPHONE_CALL_STATS_AUDIO
&&
type
!=
LINPHONE_CALL_STATS_VIDEO
)
return
;
// Avoid out of bounds if type is TEXT.
index
=
(
counters
->
current_bandwidth_index
[
type
]
++
)
%
tab_size
;
if
(
type
==
LINPHONE_CALL_STATS_AUDIO
)
{
call_stats
=
linphone_call_get_audio_stats
(
call
);
counters
->
audio_download_bandwidth
[
index
]
=
(
int
)
linphone_call_stats_get_download_bandwidth
(
call_stats
);
counters
->
audio_upload_bandwidth
[
index
]
=
(
int
)
linphone_call_stats_get_upload_bandwidth
(
call_stats
);
}
else
{
counters
->
video_download_bandwidth
[
index
]
=
(
int
)
linphone_call_stats_get_download_bandwidth
(
video_stats
);
counters
->
video_upload_bandwidth
[
index
]
=
(
int
)
linphone_call_stats_get_upload_bandwidth
(
video_stats
);
call_stats
=
linphone_call_get_video_stats
(
call
);
counters
->
video_download_bandwidth
[
index
]
=
(
int
)
linphone_call_stats_get_download_bandwidth
(
call_stats
);
counters
->
video_upload_bandwidth
[
index
]
=
(
int
)
linphone_call_stats_get_upload_bandwidth
(
call_stats
);
}
linphone_call_stats_unref
(
audio_stats
);
linphone_call_stats_unref
(
video_stats
);
linphone_call_stats_unref
(
call_stats
);
}
}
void
linphone_call_encryption_changed
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
,
bool_t
on
,
const
char
*
authentication_token
)
{
...
...
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