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
11b0bec6
Commit
11b0bec6
authored
May 15, 2014
by
Gautier Pelloux-Prayer
Browse files
add qosanalyzer.h defining private structs for unit test purpose
parent
538c9042
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
43 deletions
+85
-43
src/voip/qosanalyzer.c
src/voip/qosanalyzer.c
+8
-41
src/voip/qosanalyzer.h
src/voip/qosanalyzer.h
+75
-0
tester/mediastreamer2_video_stream_tester.c
tester/mediastreamer2_video_stream_tester.c
+2
-2
No files found.
src/voip/qosanalyzer.c
View file @
11b0bec6
...
...
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "mediastreamer2/bitratecontrol.h"
#include "qosanalyzer.h"
#include <math.h>
...
...
@@ -79,32 +80,9 @@ const char *ms_rate_control_action_type_name(MSRateControlActionType t){
return
"bad action type"
;
}
typedef
struct
rtpstats
{
uint64_t
high_seq_recv
;
/*highest sequence number received*/
float
lost_percentage
;
/*percentage of lost packet since last report*/
float
int_jitter
;
/*interrarrival jitter */
float
rt_prop
;
/*round trip propagation*/
}
rtpstats_t
;
/******************************************************************************/
/***************************** Simple QoS analyser ****************************/
/******************************************************************************/
#define STATS_HISTORY 3
static
const
float
unacceptable_loss_rate
=
10
;
static
const
int
big_jitter
=
10
;
/*ms */
static
const
float
significant_delay
=
0
.
2
;
/*seconds*/
typedef
struct
_MSSimpleQosAnalyser
{
MSQosAnalyser
parent
;
RtpSession
*
session
;
int
clockrate
;
rtpstats_t
stats
[
STATS_HISTORY
];
int
curindex
;
bool_t
rt_prop_doubled
;
bool_t
pad
[
3
];
}
MSSimpleQosAnalyser
;
static
bool_t
rt_prop_doubled
(
rtpstats_t
*
cur
,
rtpstats_t
*
prev
){
/*ms_message("AudioBitrateController: cur=%f, prev=%f",cur->rt_prop,prev->rt_prop);*/
if
(
cur
->
rt_prop
>=
significant_delay
&&
prev
->
rt_prop
>
0
){
...
...
@@ -222,21 +200,6 @@ MSQosAnalyser * ms_simple_qos_analyser_new(RtpSession *session){
/******************************************************************************/
/***************************** Stateful QoS analyser ****************************/
/******************************************************************************/
typedef
struct
_MSStatefulQosAnalyser
{
MSQosAnalyser
parent
;
RtpSession
*
session
;
int
clockrate
;
rtpstats_t
stats
[
STATS_HISTORY
];
int
curindex
;
bool_t
rt_prop_doubled
;
bool_t
pad
[
3
];
double
points
[
150
][
3
];
MSQosAnalyserNetworkState
network_state
;
}
MSStatefulQosAnalyser
;
const
char
*
ms_qos_analyser_network_state_name
(
MSQosAnalyserNetworkState
state
){
switch
(
state
){
case
MSQosAnalyserNetworkFine
:
...
...
@@ -506,9 +469,13 @@ static bool_t stateful_analyser_has_improved(MSQosAnalyser *objbase){
return
FALSE
;
}
uint32_t
ms_qos_analyser_get_network_state
(
const
MSQosAnalyser
*
objbase
){
MSStatefulQosAnalyser
*
obj
=
(
MSStatefulQosAnalyser
*
)
objbase
;
return
obj
->
network_state
;
MSQosAnalyserNetworkState
ms_qos_analyser_get_network_state
(
const
MSQosAnalyser
*
objbase
){
if
(
objbase
&&
sizeof
(
*
objbase
)
==
sizeof
(
MSStatefulQosAnalyser
)){
MSStatefulQosAnalyser
*
obj
=
(
MSStatefulQosAnalyser
*
)
objbase
;
return
obj
->
network_state
;
}
else
{
return
MSQosAnalyserNetworkFine
;
}
}
static
MSQosAnalyserDesc
stateful_analyser_desc
=
{
...
...
src/voip/qosanalyzer.h
0 → 100644
View file @
11b0bec6
/*
mediastreamer2 library - modular sound and video processing and streaming
* Copyright (C) 2011 Belledonne Communications, Grenoble, France
Author: Simon Morlat <simon.morlat@linphone.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef msqosanalyzer_hh
#define msqosanalyzer_hh
#include "mediastreamer2/bitratecontrol.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#define STATS_HISTORY 3
static
const
float
unacceptable_loss_rate
=
10
;
static
const
int
big_jitter
=
10
;
/*ms */
static
const
float
significant_delay
=
0
.
2
;
/*seconds*/
typedef
struct
rtpstats
{
uint64_t
high_seq_recv
;
/*highest sequence number received*/
float
lost_percentage
;
/*percentage of lost packet since last report*/
float
int_jitter
;
/*interrarrival jitter */
float
rt_prop
;
/*round trip propagation*/
}
rtpstats_t
;
typedef
struct
_MSSimpleQosAnalyser
{
MSQosAnalyser
parent
;
RtpSession
*
session
;
int
clockrate
;
rtpstats_t
stats
[
STATS_HISTORY
];
int
curindex
;
bool_t
rt_prop_doubled
;
bool_t
pad
[
3
];
}
MSSimpleQosAnalyser
;
typedef
struct
_MSStatefulQosAnalyser
{
MSQosAnalyser
parent
;
RtpSession
*
session
;
int
clockrate
;
rtpstats_t
stats
[
STATS_HISTORY
];
int
curindex
;
bool_t
rt_prop_doubled
;
bool_t
pad
[
3
];
MSQosAnalyserNetworkState
network_state
;
double
points
[
150
][
3
];
}
MSStatefulQosAnalyser
;
MSQosAnalyserNetworkState
ms_qos_analyser_get_network_state
(
const
MSQosAnalyser
*
objbase
);
#ifdef __cplusplus
}
#endif
#endif
tester/mediastreamer2_video_stream_tester.c
View file @
11b0bec6
...
...
@@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h>
#include "CUnit/Basic.h"
#include "qosanalyzer.h"
#ifdef _MSC_VER
#define unlink _unlink
...
...
@@ -128,11 +129,10 @@ static void handle_queue_events(video_stream_manager_t * stream_mgr, OrtpEvQueue
}
if
(
rb
)
{
stream_mgr
->
latest_stats
.
loss
=
100
.
0
*
(
float
)
report_block_get_fraction_lost
(
rb
)
/
256
.
0
;
stream_mgr
->
latest_stats
.
rtt
=
rtp_session_get_round_trip_propagation
(
stream_mgr
->
stream
->
ms
.
sessions
.
rtp_session
);
/*
stream_mgr->latest_stats.network_state=ms_qos_analyser_get_network_state(ms_bitrate_controller_get_qos_analyser(stream_mgr->stream->ms.rc));
*/
stream_mgr
->
latest_stats
.
network_state
=
ms_qos_analyser_get_network_state
(
ms_bitrate_controller_get_qos_analyser
(
stream_mgr
->
stream
->
ms
.
rc
));
ms_message
(
"mediastreamer2_video_stream_tester: %s RTCP packet: loss=%f, RTT=%f, network_state=%d"
,(
evt
==
ORTP_EVENT_RTCP_PACKET_RECEIVED
)
?
"RECEIVED"
:
"EMITTED"
,
stream_mgr
->
latest_stats
.
loss
...
...
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