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
f1e47c40
Commit
f1e47c40
authored
May 13, 2015
by
Gautier Pelloux-Prayer
Browse files
tester: use new macros instead of CUnit ones to get better error logs
parent
aedf1df3
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
292 additions
and
316 deletions
+292
-316
tester/common/bc_tester_utils.c
tester/common/bc_tester_utils.c
+1
-0
tester/common/bc_tester_utils.h
tester/common/bc_tester_utils.h
+60
-60
tester/mediastreamer2_adaptive_tester.c
tester/mediastreamer2_adaptive_tester.c
+30
-32
tester/mediastreamer2_audio_stream_tester.c
tester/mediastreamer2_audio_stream_tester.c
+94
-93
tester/mediastreamer2_basic_audio_tester.c
tester/mediastreamer2_basic_audio_tester.c
+2
-6
tester/mediastreamer2_framework_tester.c
tester/mediastreamer2_framework_tester.c
+16
-20
tester/mediastreamer2_player_tester.c
tester/mediastreamer2_player_tester.c
+17
-17
tester/mediastreamer2_sound_card_tester.c
tester/mediastreamer2_sound_card_tester.c
+0
-4
tester/mediastreamer2_tester.c
tester/mediastreamer2_tester.c
+0
-6
tester/mediastreamer2_tester_private.c
tester/mediastreamer2_tester_private.c
+27
-27
tester/mediastreamer2_video_stream_tester.c
tester/mediastreamer2_video_stream_tester.c
+45
-51
No files found.
tester/common/bc_tester_utils.c
View file @
f1e47c40
...
...
@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdlib.h>
#include "CUnit/Basic.h"
#include "CUnit/Automated.h"
#if WINAPI_FAMILY_PHONE_APP
...
...
tester/common/bc_tester_utils.h
View file @
f1e47c40
...
...
@@ -20,7 +20,6 @@
#ifndef TESTER_UTILS_H
#define TESTER_UTILS_H
#include "CUnit/Basic.h"
#include <stdio.h>
#include <stdarg.h>
...
...
@@ -31,6 +30,8 @@ extern int bc_printf_verbosity_info;
extern
int
bc_printf_verbosity_error
;
typedef
void
(
*
test_function_t
)(
void
);
typedef
int
(
*
init_function_t
)(
void
);
typedef
int
(
*
cleanup_function_t
)(
void
);
typedef
int
(
*
test_suite_function_t
)(
const
char
*
name
);
typedef
struct
{
...
...
@@ -40,8 +41,8 @@ typedef struct {
typedef
struct
{
const
char
*
name
;
CU_InitializeFunc
init_func
;
CU_C
leanup
F
unc
cleanup_func
;
init_function_t
init_func
;
c
leanup
_f
unc
tion_t
cleanup_func
;
int
nb_tests
;
test_t
*
tests
;
}
test_suite_t
;
...
...
@@ -85,63 +86,62 @@ int bc_tester_suite_index(const char *suite_name);
*/
char
*
bc_tester_res
(
const
char
*
name
);
/*Redefine the CU_... macros WITHOUT final ';' semicolon, to allow IF conditions */
#define BC_ASSERT_EQUAL(actual, expected) CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_PASS(msg) CU_assertImplementation(CU_TRUE, __LINE__, ("CU_PASS(" #msg ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_FALSE)
#define BC_ASSERT_FATAL(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_TRUE)
#define BC_TEST(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_FALSE)
#define BC_TEST_FATAL(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_TRUE)
#define BC_ASSERT_TRUE(value) CU_assertImplementation((value), __LINE__, ("CU_ASSERT_TRUE(" #value ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_TRUE_FATAL(value) CU_assertImplementation((value), __LINE__, ("CU_ASSERT_TRUE_FATAL(" #value ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_FALSE(value) CU_assertImplementation(!(value), __LINE__, ("CU_ASSERT_FALSE(" #value ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_FALSE_FATAL(value) CU_assertImplementation(!(value), __LINE__, ("CU_ASSERT_FALSE_FATAL(" #value ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_EQUAL(actual, expected) CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_EQUAL_FATAL(actual, expected) CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_NOT_EQUAL(actual, expected) CU_assertImplementation(((actual) != (expected)), __LINE__, ("CU_ASSERT_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_NOT_EQUAL_FATAL(actual, expected) CU_assertImplementation(((actual) != (expected)), __LINE__, ("CU_ASSERT_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_PTR_EQUAL(actual, expected) CU_assertImplementation(((const void*)(actual) == (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_PTR_EQUAL_FATAL(actual, expected) CU_assertImplementation(((const void*)(actual) == (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_PTR_NOT_EQUAL(actual, expected) CU_assertImplementation(((const void*)(actual) != (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected) CU_assertImplementation(((const void*)(actual) != (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_PTR_NULL(value) CU_assertImplementation((NULL == (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NULL(" #value")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_PTR_NULL_FATAL(value) CU_assertImplementation((NULL == (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NULL_FATAL(" #value")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_PTR_NOT_NULL(value) CU_assertImplementation((NULL != (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NOT_NULL(" #value")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_PTR_NOT_NULL_FATAL(value) CU_assertImplementation((NULL != (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NOT_NULL_FATAL(" #value")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_STRING_EQUAL(actual, expected) CU_assertImplementation(!(strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_STRING_EQUAL_FATAL(actual, expected) CU_assertImplementation(!(strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_STRING_NOT_EQUAL(actual, expected) CU_assertImplementation((strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected) CU_assertImplementation((strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_NSTRING_EQUAL(actual, expected, count) CU_assertImplementation(!(strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count) CU_assertImplementation(!(strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_EQUAL_FATAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) CU_assertImplementation((strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_NOT_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count) CU_assertImplementation((strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_NOT_EQUAL_FATAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_DOUBLE_EQUAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) <= fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) <= fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_EQUAL_FATAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) > fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_NOT_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) > fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_NOT_EQUAL_FATAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_GREATER(actual, expected) CU_assertImplementation(((actual) >= (expected)), __LINE__, ("CU_ASSERT_GREATER(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_LOWER(actual, expected) CU_assertImplementation(((actual) <= (expected)), __LINE__, ("CU_ASSERT_LOWER(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
/*Add some custom defines with logs in case of fail*/
#define BC_ASSERT_EQUAL_WITH_TYPE(actual, expected, type, type_format) { \
type cactual = (actual), cexpected = (expected); \
if (! BC_ASSERT_EQUAL(cactual, cexpected)) { \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " = " #expected " but was " type_format " != " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \
} \
}
#define BC_ASSERT_GREATER_WITH_TYPE(actual, expected, type, type_format) { \
type cactual = (actual), cexpected = (expected); \
if (! BC_ASSERT_GREATER(cactual, cexpected)) { \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " >= " #expected " but was " type_format " < " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \
} \
}
#define BC_ASSERT_LOWER_WITH_TYPE(actual, expected, type, type_format) { \
type cactual = (actual), cexpected = (expected); \
if (! BC_ASSERT_LOWER(cactual, cexpected)) { \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " <= " #expected " but was " type_format " > " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \
} \
}
/*Redefine the CU_... macros WITHOUT final ';' semicolon, to allow IF conditions and with smarter error message */
extern
int
CU_assertImplementation
(
int
bValue
,
unsigned
int
uiLine
,
const
char
*
strCondition
,
const
char
*
strFile
,
const
char
*
strFunction
,
int
bFatal
);
#define _BC_ASSERT(pred, format, fatal) CU_assertImplementation(pred, __LINE__, format, __FILE__, "", fatal)
#define _BC_ASSERT_PRED(name, pred, actual, expected, type, fatal, ...) \
do { \
char format[512]; \
type cactual = (actual); \
type cexpected = (expected); \
sprintf(format, name "(" #actual ", " #expected ") - " __VA_ARGS__); \
_BC_ASSERT(pred, format, fatal); \
} while (0)
#define BC_PASS(msg) _BC_ASSERT(TRUE, "BC_PASS(" #msg ").", FALSE)
#define BC_FAIL(msg) _BC_ASSERT(FALSE, "BC_FAIL(" #msg ").", FALSE)
#define BC_ASSERT(value) _BC_ASSERT((value), #value, FALSE)
#define BC_ASSERT_FATAL(value) _BC_ASSERT((value), #value, TRUE)
#define BC_TEST(value) _BC_ASSERT((value), #value, FALSE)
#define BC_TEST_FATAL(value) _BC_ASSERT((value), #value, TRUE)
#define BC_ASSERT_TRUE(value) _BC_ASSERT((value), ("BC_ASSERT_TRUE(" #value ")"), FALSE)
#define BC_ASSERT_TRUE_FATAL(value) _BC_ASSERT((value), ("BC_ASSERT_TRUE_FATAL(" #value ")"), TRUE)
#define BC_ASSERT_FALSE(value) _BC_ASSERT(!(value), ("BC_ASSERT_FALSE(" #value ")"), FALSE)
#define BC_ASSERT_FALSE_FATAL(value) _BC_ASSERT(!(value), ("BC_ASSERT_FALSE_FATAL(" #value ")"), TRUE)
#define BC_ASSERT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL", ((cactual) == (cexpected)), actual, expected, type, FALSE, "Expected " type_format " but was " type_format ".\n", cexpected, cactual)
#define BC_ASSERT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL_FATAL", ((cactual) == (cexpected)), actual, expected, type, TRUE, "Expected " type_format " but was " type_format ".\n", cexpected, cactual)
#define BC_ASSERT_NOT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL", ((cactual) != (cexpected)), actual, expected, type, FALSE, "Expected NOT " type_format " but it was.\n", cexpected)
#define BC_ASSERT_NOT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), actual, expected, type, TRUE, "Expected NOT " type_format " but it was.\n", cexpected)
#define BC_ASSERT_PTR_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected %p but was %p.\n", cexpected, cactual)
#define BC_ASSERT_PTR_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL_FATAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected %p but was %p.\n", cexpected, cactual)
#define BC_ASSERT_PTR_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected NOT %p but it was.\n", cexpected)
#define BC_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected NOT %p but it was.\n", cexpected)
#define BC_ASSERT_PTR_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL", ((cactual) == (cexpected)), (const void*)(value), (const void*)NULL, const void*, FALSE, "Expected NULL but was %p.\n", cactual)
#define BC_ASSERT_PTR_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL_FATAL", ((cactual) == (cexpected)), (const void*)(value), (const void*)NULL, const void*, TRUE, "Expected NULL but was %p.\n", cactual)
#define BC_ASSERT_PTR_NOT_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL", ((cactual) != (cexpected)), (const void*)(value), (const void*)NULL, const void*, FALSE, "Expected NOT NULL but it was.\n")
#define BC_ASSERT_PTR_NOT_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL_FATAL", ((cactual) != (cexpected)), (const void*)(value), (const void*)NULL, const void*, TRUE, "Expected NOT NULL but it was.\n")
#define BC_ASSERT_STRING_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected %s but was %s.\n", cexpected, cactual)
#define BC_ASSERT_STRING_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL_FATAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected %s but was %s.\n", cexpected, cactual)
#define BC_ASSERT_STRING_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected NOT %s but it was.\n", cexpected)
#define BC_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL_FATAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected NOT %s but it was.\n", cexpected)
#define BC_ASSERT_NSTRING_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but was %*s.\n", count, cexpected, count, cactual)
#define BC_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL_FATAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but was %*s.\n", count, cexpected, count, cactual)
#define BC_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but it was.\n", count, cexpected)
#define BC_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL_FATAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but it was.\n", count, cexpected)
#define BC_ASSERT_DOUBLE_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.\n", cexpected, cactual)
#define BC_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.\n", cexpected, cactual)
#define BC_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.\n", cexpected, cactual)
#define BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.\n", cexpected, cactual)
/*Custom defines*/
#define BC_ASSERT_GREATER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_GREATER", ((cactual) >= (cexpected)), actual, lower, type, FALSE, "Expected " type_format " but was " type_format ".\n", cexpected, cactual)
#define BC_ASSERT_LOWER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_LOWER", ((cactual) <= (cexpected)), actual, lower, type, FALSE, "Expected " type_format " but was " type_format ".\n", cexpected, cactual)
#ifdef __cplusplus
}
...
...
tester/mediastreamer2_adaptive_tester.c
View file @
f1e47c40
...
...
@@ -26,10 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2_tester.h"
#include "mediastreamer2_tester_private.h"
#include "qosanalyzer.h"
#include <stdio.h>
#include "CUnit/Basic.h"
#include <math.h>
static
RtpProfile
rtp_profile
;
...
...
@@ -139,19 +136,20 @@ static void audio_manager_start(stream_manager_t * mgr
media_stream_set_target_network_bitrate
(
&
mgr
->
audio_stream
->
ms
,
target_bitrate
);
CU_ASSERT_EQUAL
(
audio_stream_start_full
(
mgr
->
audio_stream
,
&
rtp_profile
,
"127.0.0.1"
,
remote_port
,
"127.0.0.1"
,
remote_port
+
1
,
payload_type
,
50
,
player_file
,
recorder_file
,
NULL
,
NULL
,
0
),
0
);
BC_ASSERT_EQUAL
(
audio_stream_start_full
(
mgr
->
audio_stream
,
&
rtp_profile
,
"127.0.0.1"
,
remote_port
,
"127.0.0.1"
,
remote_port
+
1
,
payload_type
,
50
,
player_file
,
recorder_file
,
NULL
,
NULL
,
0
)
,
0
,
int
,
"%d"
);
}
#if VIDEO_ENABLED
...
...
@@ -172,7 +170,7 @@ static void video_manager_start( stream_manager_t * mgr
,
payload_type
,
60
,
cam
);
C
U
_ASSERT_EQUAL
(
result
,
0
);
B
C_ASSERT_EQUAL
(
result
,
0
,
int
,
"%d"
);
}
#endif
...
...
@@ -221,7 +219,7 @@ void start_adaptive_stream(MSFormatType type, stream_manager_t ** pmarielle, str
/* Disable avpf. */
pt
=
rtp_profile_get_payload
(
&
rtp_profile
,
VP8_PAYLOAD_TYPE
);
C
U
_ASSERT_PTR_NOT_NULL_FATAL
(
pt
);
B
C_ASSERT_PTR_NOT_NULL_FATAL
(
pt
);
payload_type_unset_flag
(
pt
,
PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED
);
...
...
@@ -310,8 +308,8 @@ static void event_queue_cb(MediaStream *ms, void *user_pointer) {
if
(
rb
&&
ortp_loss_rate_estimator_process_report_block
(
ctx
->
estimator
,
&
ms
->
sessions
.
rtp_session
->
rtp
,
rb
)){
float
diff
=
fabs
(
ortp_loss_rate_estimator_get_value
(
ctx
->
estimator
)
-
ctx
->
loss_rate
);
C
U
_ASSERT_TRUE
(
diff
>=
0
);
C
U
_ASSERT_TRUE
(
diff
<=
10
);
B
C_ASSERT_TRUE
(
diff
>=
0
);
B
C_ASSERT_TRUE
(
diff
<=
10
);
}
}
while
(
rtcp_next_packet
(
evd
->
packet
));
}
...
...
@@ -331,11 +329,11 @@ static void packet_duplication() {
media_stream_enable_adaptive_bitrate_control
(
&
marielle
->
audio_stream
->
ms
,
FALSE
);
iterate_adaptive_stream
(
marielle
,
margaux
,
10000
,
NULL
,
0
);
stats
=
rtp_session_get_stats
(
margaux
->
video_stream
->
ms
.
sessions
.
rtp_session
);
C
U
_ASSERT_EQUAL
(
stats
->
packet_dup_recv
,
dup_ratio
?
stats
->
packet_recv
/
(
dup_ratio
+
1
)
:
0
);
B
C_ASSERT_EQUAL
(
stats
->
packet_dup_recv
,
dup_ratio
?
stats
->
packet_recv
/
(
dup_ratio
+
1
)
:
0
,
int
,
"%d"
);
/*in theory, cumulative loss should be the invert of duplicated count, but
since cumulative loss is computed only on received RTCP report and duplicated
count is updated on each RTP packet received, we cannot accurately compare these values*/
C
U
_ASSERT_TRUE
(
stats
->
cum_packet_loss
<=
-
.
5
*
stats
->
packet_dup_recv
);
B
C_ASSERT_TRUE
(
stats
->
cum_packet_loss
<=
-
.
5
*
stats
->
packet_dup_recv
);
stop_adaptive_stream
(
marielle
,
margaux
);
dup_ratio
=
1
;
...
...
@@ -343,8 +341,8 @@ static void packet_duplication() {
media_stream_enable_adaptive_bitrate_control
(
&
marielle
->
audio_stream
->
ms
,
FALSE
);
iterate_adaptive_stream
(
marielle
,
margaux
,
10000
,
NULL
,
0
);
stats
=
rtp_session_get_stats
(
margaux
->
video_stream
->
ms
.
sessions
.
rtp_session
);
C
U
_ASSERT_EQUAL
(
stats
->
packet_dup_recv
,
dup_ratio
?
stats
->
packet_recv
/
(
dup_ratio
+
1
)
:
0
);
C
U
_ASSERT_TRUE
(
stats
->
cum_packet_loss
<=
-
.
5
*
stats
->
packet_dup_recv
);
B
C_ASSERT_EQUAL
(
stats
->
packet_dup_recv
,
dup_ratio
?
stats
->
packet_recv
/
(
dup_ratio
+
1
)
:
0
,
int
,
"%d"
);
B
C_ASSERT_TRUE
(
stats
->
cum_packet_loss
<=
-
.
5
*
stats
->
packet_dup_recv
);
stop_adaptive_stream
(
marielle
,
margaux
);
}
...
...
@@ -361,7 +359,7 @@ static void upload_bandwidth_computation() {
rtp_session_set_duplication_ratio
(
marielle
->
audio_stream
->
ms
.
sessions
.
rtp_session
,
i
);
iterate_adaptive_stream
(
marielle
,
margaux
,
5000
,
NULL
,
0
);
/*since PCMA uses 80kbit/s, upload bandwidth should just be 80+80*duplication_ratio kbit/s */
C
U
_ASSERT_TRUE
(
fabs
(
rtp_session_get_send_bandwidth
(
marielle
->
audio_stream
->
ms
.
sessions
.
rtp_session
)
/
1000
.
-
80
.
*
(
i
+
1
))
<
5
.
f
);
B
C_ASSERT_TRUE
(
fabs
(
rtp_session_get_send_bandwidth
(
marielle
->
audio_stream
->
ms
.
sessions
.
rtp_session
)
/
1000
.
-
80
.
*
(
i
+
1
))
<
5
.
f
);
}
stop_adaptive_stream
(
marielle
,
margaux
);
}
...
...
@@ -405,8 +403,8 @@ void upload_bitrate(const char* codec, int payload, int target_bw, int expect_bw
media_stream_enable_adaptive_bitrate_control
(
&
marielle
->
audio_stream
->
ms
,
FALSE
);
iterate_adaptive_stream
(
marielle
,
margaux
,
15000
,
NULL
,
0
);
upload_bw
=
media_stream_get_up_bw
(
&
marielle
->
audio_stream
->
ms
)
/
1000
;
C
U
_ASSERT_TRUE
(
upload_bw
>=
expect_bw
-
2
);
C
U
_ASSERT_TRUE
(
upload_bw
<=
expect_bw
+
2
);
B
C_ASSERT_TRUE
(
upload_bw
>=
expect_bw
-
2
);
B
C_ASSERT_TRUE
(
upload_bw
<=
expect_bw
+
2
);
stop_adaptive_stream
(
marielle
,
margaux
);
}
}
...
...
@@ -451,10 +449,10 @@ void adaptive_video(int max_bw, int exp_min_bw, int exp_max_bw, int loss_rate, i
stream_manager_t
*
marielle
,
*
margaux
;
start_adaptive_stream
(
MSVideo
,
&
marielle
,
&
margaux
,
VP8_PAYLOAD_TYPE
,
300
*
1000
,
max_bw
*
1000
,
loss_rate
,
50
,
0
);
iterate_adaptive_stream
(
marielle
,
margaux
,
100000
,
&
marielle
->
rtcp_count
,
7
);
C
U
_ASSERT_TRUE
(
marielle
->
adaptive_stats
.
loss_estim
>=
exp_min_loss
);
C
U
_ASSERT_TRUE
(
marielle
->
adaptive_stats
.
loss_estim
<=
exp_max_loss
);
C
U
_ASSERT_TRUE
(
marielle
->
adaptive_stats
.
congestion_bw_estim
>=
exp_min_bw
);
C
U
_ASSERT_TRUE
(
marielle
->
adaptive_stats
.
congestion_bw_estim
<=
exp_max_bw
);
B
C_ASSERT_TRUE
(
marielle
->
adaptive_stats
.
loss_estim
>=
exp_min_loss
);
B
C_ASSERT_TRUE
(
marielle
->
adaptive_stats
.
loss_estim
<=
exp_max_loss
);
B
C_ASSERT_TRUE
(
marielle
->
adaptive_stats
.
congestion_bw_estim
>=
exp_min_bw
);
B
C_ASSERT_TRUE
(
marielle
->
adaptive_stats
.
congestion_bw_estim
<=
exp_max_bw
);
stop_adaptive_stream
(
marielle
,
margaux
);
}
}
...
...
tester/mediastreamer2_audio_stream_tester.c
View file @
f1e47c40
...
...
@@ -26,10 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2_tester.h"
#include "mediastreamer2_tester_private.h"
#include <stdio.h>
#include "CUnit/Basic.h"
static
RtpProfile
rtp_profile
;
#define OPUS_PAYLOAD_TYPE 121
...
...
@@ -144,7 +140,7 @@ static void basic_audio_stream_base( const char* marielle_local_ip
rtp_profile_set_payload
(
profile
,
0
,
&
payload_type_pcmu8000
);
C
U
_ASSERT_EQUAL
(
audio_stream_start_full
(
margaux
B
C_ASSERT_EQUAL
(
audio_stream_start_full
(
margaux
,
profile
,
ms_is_multicast
(
margaux_local_ip
)
?
margaux_local_ip
:
marielle_local_ip
,
ms_is_multicast
(
margaux_local_ip
)
?
margaux_local_rtp_port
:
marielle_local_rtp_port
...
...
@@ -156,9 +152,10 @@ static void basic_audio_stream_base( const char* marielle_local_ip
,
recorded_file
,
NULL
,
NULL
,
0
),
0
);
,
0
)
,
0
,
int
,
"%d"
);
C
U
_ASSERT_EQUAL
(
audio_stream_start_full
(
marielle
B
C_ASSERT_EQUAL
(
audio_stream_start_full
(
marielle
,
profile
,
margaux_local_ip
,
margaux_local_rtp_port
...
...
@@ -170,11 +167,12 @@ static void basic_audio_stream_base( const char* marielle_local_ip
,
NULL
,
NULL
,
NULL
,
0
),
0
);
,
0
)
,
0
,
int
,
"%d"
);
ms_filter_add_notify_callback
(
marielle
->
soundread
,
notify_cb
,
&
marielle_stats
,
TRUE
);
C
U
_ASSERT_TRUE
(
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
marielle_stats
.
number_of_EndOfFile
,
1
,
12000
));
B
C_ASSERT_TRUE
(
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
marielle_stats
.
number_of_EndOfFile
,
1
,
12000
));
/*make sure packets can cross from sender to receiver*/
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
dummy
,
1
,
500
);
...
...
@@ -183,7 +181,7 @@ static void basic_audio_stream_base( const char* marielle_local_ip
audio_stream_get_local_rtp_stats
(
margaux
,
&
margaux_stats
.
rtp
);
/* No packet loss is assumed */
C
U
_ASSERT_EQUAL
(
marielle_stats
.
rtp
.
sent
,
margaux_stats
.
rtp
.
recv
);
B
C_ASSERT_EQUAL
(
marielle_stats
.
rtp
.
sent
,
margaux_stats
.
rtp
.
recv
,
int
,
"%d"
);
audio_stream_stop
(
marielle
);
audio_stream_stop
(
margaux
);
...
...
@@ -226,80 +224,82 @@ static void encrypted_audio_stream_base( bool_t change_ssrc,
rtp_profile_set_payload
(
profile
,
0
,
&
payload_type_pcmu8000
);
CU_ASSERT_EQUAL
(
audio_stream_start_full
(
margaux
,
profile
,
MARIELLE_IP
,
MARIELLE_RTP_PORT
,
MARIELLE_IP
,
MARIELLE_RTCP_PORT
,
0
,
50
,
NULL
,
recorded_file
,
NULL
,
NULL
,
0
),
0
);
CU_ASSERT_EQUAL
(
audio_stream_start_full
(
marielle
,
profile
,
MARGAUX_IP
,
MARGAUX_RTP_PORT
,
MARGAUX_IP
,
MARGAUX_RTCP_PORT
,
0
,
50
,
hello_file
,
NULL
,
NULL
,
NULL
,
0
),
0
);
BC_ASSERT_EQUAL
(
audio_stream_start_full
(
margaux
,
profile
,
MARIELLE_IP
,
MARIELLE_RTP_PORT
,
MARIELLE_IP
,
MARIELLE_RTCP_PORT
,
0
,
50
,
NULL
,
recorded_file
,
NULL
,
NULL
,
0
)
,
0
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
audio_stream_start_full
(
marielle
,
profile
,
MARGAUX_IP
,
MARGAUX_RTP_PORT
,
MARGAUX_IP
,
MARGAUX_RTCP_PORT
,
0
,
50
,
hello_file
,
NULL
,
NULL
,
NULL
,
0
)
,
0
,
int
,
"%d"
);
if
(
encryption_mandatory
)
{
/*wait a bit to make sure packets are discarded*/
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
dummy
,
1
,
1000
);
audio_stream_get_local_rtp_stats
(
margaux
,
&
margaux_stats
.
rtp
);
audio_stream_get_local_rtp_stats
(
marielle
,
&
marielle_stats
.
rtp
);
C
U
_ASSERT_EQUAL
(
margaux_stats
.
rtp
.
recv
,
0
);
B
C_ASSERT_EQUAL
(
margaux_stats
.
rtp
.
recv
,
0
,
int
,
"%d"
);
number_of_dropped_packets
=
marielle_stats
.
rtp
.
packet_sent
;
}
if
(
send_key_first
)
{
C
U
_ASSERT_TRUE
(
media_stream_set_srtp_send_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"
)
==
0
);
B
C_ASSERT_TRUE
(
media_stream_set_srtp_send_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"
)
==
0
);
if
(
set_both_send_recv_key
)
C
U
_ASSERT_TRUE
(
media_stream_set_srtp_send_key_b64
(
&
(
margaux
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F"
)
==
0
);
B
C_ASSERT_TRUE
(
media_stream_set_srtp_send_key_b64
(
&
(
margaux
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F"
)
==
0
);
C
U
_ASSERT_TRUE
(
media_stream_set_srtp_recv_key_b64
(
&
(
margaux
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"
)
==
0
);
B
C_ASSERT_TRUE
(
media_stream_set_srtp_recv_key_b64
(
&
(
margaux
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"
)
==
0
);
if
(
set_both_send_recv_key
)
C
U
_ASSERT_TRUE
(
media_stream_set_srtp_recv_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F"
)
==
0
);
B
C_ASSERT_TRUE
(
media_stream_set_srtp_recv_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F"
)
==
0
);
}
else
{
C
U
_ASSERT_TRUE
(
media_stream_set_srtp_recv_key_b64
(
&
(
margaux
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"
)
==
0
);
B
C_ASSERT_TRUE
(
media_stream_set_srtp_recv_key_b64
(
&
(
margaux
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"
)
==
0
);
if
(
set_both_send_recv_key
)
C
U
_ASSERT_TRUE
(
media_stream_set_srtp_recv_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F"
)
==
0
);
B
C_ASSERT_TRUE
(
media_stream_set_srtp_recv_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F"
)
==
0
);
C
U
_ASSERT_TRUE
(
media_stream_set_srtp_send_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"
)
==
0
);
B
C_ASSERT_TRUE
(
media_stream_set_srtp_send_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"
)
==
0
);
if
(
set_both_send_recv_key
)
C
U
_ASSERT_TRUE
(
media_stream_set_srtp_send_key_b64
(
&
(
margaux
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F"
)
==
0
);
B
C_ASSERT_TRUE
(
media_stream_set_srtp_send_key_b64
(
&
(
margaux
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F"
)
==
0
);
}
if
(
set_both_send_recv_key
)
{
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
dummy
,
1
,
1000
);
C
U
_ASSERT_TRUE
(
media_stream_secured
((
MediaStream
*
)
marielle
));
C
U
_ASSERT_TRUE
(
media_stream_secured
((
MediaStream
*
)
margaux
));
B
C_ASSERT_TRUE
(
media_stream_secured
((
MediaStream
*
)
marielle
));
B
C_ASSERT_TRUE
(
media_stream_secured
((
MediaStream
*
)
margaux
));
}
else
{
/*so far, not possible to know audio stream direction*/
C
U
_ASSERT_FALSE
(
media_stream_secured
((
MediaStream
*
)
marielle
));
C
U
_ASSERT_FALSE
(
media_stream_secured
((
MediaStream
*
)
margaux
));
B
C_ASSERT_FALSE
(
media_stream_secured
((
MediaStream
*
)
marielle
));
B
C_ASSERT_FALSE
(
media_stream_secured
((
MediaStream
*
)
margaux
));
}
ms_filter_add_notify_callback
(
marielle
->
soundread
,
notify_cb
,
&
marielle_stats
,
TRUE
);
if
(
change_send_key_in_the_middle
)
{
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
dummy
,
1
,
2000
);
C
U
_ASSERT_TRUE
(
media_stream_set_srtp_send_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"eCYF4nYyCvmCpFWjUeDaxI2GWp2BzCRlIPfg52Te"
)
==
0
);
C
U
_ASSERT_TRUE
(
media_stream_set_srtp_recv_key_b64
(
&
(
margaux
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"eCYF4nYyCvmCpFWjUeDaxI2GWp2BzCRlIPfg52Te"
)
==
0
);
B
C_ASSERT_TRUE
(
media_stream_set_srtp_send_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"eCYF4nYyCvmCpFWjUeDaxI2GWp2BzCRlIPfg52Te"
)
==
0
);
B
C_ASSERT_TRUE
(
media_stream_set_srtp_recv_key_b64
(
&
(
margaux
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"eCYF4nYyCvmCpFWjUeDaxI2GWp2BzCRlIPfg52Te"
)
==
0
);
}
C
U
_ASSERT_TRUE
(
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
marielle_stats
.
number_of_EndOfFile
,
1
,
12000
));
B
C_ASSERT_TRUE
(
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
marielle_stats
.
number_of_EndOfFile
,
1
,
12000
));
/*make sure packets can cross from sender to receiver*/
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
dummy
,
1
,
500
);
...
...
@@ -310,31 +310,32 @@ static void encrypted_audio_stream_base( bool_t change_ssrc,
/* No packet loss is assumed */
if
(
change_send_key_in_the_middle
)
{
/*we can accept one or 2 error in such case*/
C
U
_ASSERT_TRUE
((
marielle_stats
.
rtp
.
packet_sent
-
margaux_stats
.
rtp
.
packet_recv
-
number_of_dropped_packets
)
<
3
);
B
C_ASSERT_TRUE
((
marielle_stats
.
rtp
.
packet_sent
-
margaux_stats
.
rtp
.
packet_recv
-
number_of_dropped_packets
)
<
3
);
}
else
C
U
_ASSERT_EQUAL
(
marielle_stats
.
rtp
.
packet_sent
,
margaux_stats
.
rtp
.
packet_recv
+
number_of_dropped_packets
);
B
C_ASSERT_EQUAL
(
marielle_stats
.
rtp
.
packet_sent
,
margaux_stats
.
rtp
.
packet_recv
+
number_of_dropped_packets
,
int
,
"%d"
);
if
(
change_ssrc
)
{
audio_stream_stop
(
marielle
);
marielle
=
audio_stream_new
(
MARIELLE_RTP_PORT
,
MARIELLE_RTCP_PORT
,
FALSE
);
CU_ASSERT_EQUAL
(
audio_stream_start_full
(
marielle
,
profile
,
MARGAUX_IP
,
MARGAUX_RTP_PORT
,
MARGAUX_IP
,
MARGAUX_RTCP_PORT
,
0
,
50
,
hello_file
,
NULL
,
NULL
,
NULL
,
0
),
0
);
CU_ASSERT_FATAL
(
media_stream_set_srtp_send_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"
)
==
0
);
BC_ASSERT_EQUAL
(
audio_stream_start_full
(
marielle
,
profile
,
MARGAUX_IP
,
MARGAUX_RTP_PORT
,
MARGAUX_IP
,
MARGAUX_RTCP_PORT
,
0
,
50
,
hello_file
,
NULL
,
NULL
,
NULL
,
0
)
,
0
,
int
,
"%d"
);
BC_ASSERT_FATAL
(
media_stream_set_srtp_send_key_b64
(
&
(
marielle
->
ms
.
sessions
),
MS_AES_128_SHA1_32
,
"d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"
)
==
0
);
ms_filter_add_notify_callback
(
marielle
->
soundread
,
notify_cb
,
&
marielle_stats
,
TRUE
);
C
U
_ASSERT_TRUE
(
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
marielle_stats
.
number_of_EndOfFile
,
2
,
12000
));
B
C_ASSERT_TRUE
(
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
marielle_stats
.
number_of_EndOfFile
,
2
,
12000
));
/*make sure packets can cross from sender to receiver*/
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
dummy
,
1
,
500
);
...
...
@@ -343,7 +344,7 @@ static void encrypted_audio_stream_base( bool_t change_ssrc,
audio_stream_get_local_rtp_stats
(
margaux
,
&
margaux_stats
.
rtp
);
/* No packet loss is assumed */
C
U
_ASSERT_EQUAL
(
marielle_stats
.
rtp
.
sent
*
2
,
margaux_stats
.
rtp
.
recv
);
B
C_ASSERT_EQUAL
(
marielle_stats
.
rtp
.
sent
*
2
,
margaux_stats
.
rtp
.
recv
,
int
,
"%d"
);
}
...
...
@@ -402,15 +403,15 @@ static void codec_change_for_audio_stream(void) {
rtp_profile_set_payload
(
profile
,
0
,
&
payload_type_pcmu8000
);
rtp_profile_set_payload
(
profile
,
8
,
&
payload_type_pcma8000
);
C
U
_ASSERT_EQUAL
(
audio_stream_start_full
(
margaux
,
profile
,
MARIELLE_IP
,
MARIELLE_RTP_PORT
,
MARIELLE_IP
,
MARIELLE_RTCP_PORT
,
0
,
50
,
NULL
,
recorded_file
,
NULL
,
NULL
,
0
),
0
);
B
C_ASSERT_EQUAL
(
audio_stream_start_full
(
margaux
,
profile
,
MARIELLE_IP
,
MARIELLE_RTP_PORT
,
MARIELLE_IP
,
MARIELLE_RTCP_PORT
,
0
,
50
,
NULL
,
recorded_file
,
NULL
,
NULL
,
0
),
0
,
int
,
"%d"
);
C
U
_ASSERT_EQUAL
(
audio_stream_start_full
(
marielle
,
profile
,
MARGAUX_IP
,
MARGAUX_RTP_PORT
,
MARGAUX_IP
,
MARGAUX_RTCP_PORT
,
0
,
50
,
hello_file
,
NULL
,
NULL
,
NULL
,
0
),
0
);
B
C_ASSERT_EQUAL
(
audio_stream_start_full
(
marielle
,
profile
,
MARGAUX_IP
,
MARGAUX_RTP_PORT
,
MARGAUX_IP
,
MARGAUX_RTCP_PORT
,
0
,
50
,
hello_file
,
NULL
,
NULL
,
NULL
,
0
),
0
,
int
,
"%d"
);
ms_filter_add_notify_callback
(
marielle
->
soundread
,
notify_cb
,
&
marielle_stats
,
TRUE
);
C
U
_ASSERT_TRUE
(
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
marielle_stats
.
number_of_EndOfFile
,
1
,
12000
));
B
C_ASSERT_TRUE
(
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
marielle_stats
.
number_of_EndOfFile
,
1
,
12000
));
/*make sure packets can cross from sender to receiver*/
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
dummy
,
1
,
500
);
...
...
@@ -419,19 +420,19 @@ static void codec_change_for_audio_stream(void) {
audio_stream_get_local_rtp_stats
(
margaux
,
&
margaux_stats
.
rtp
);
/* No packet loss is assumed */
C
U
_ASSERT_EQUAL
(
marielle_stats
.
rtp
.
sent
,
margaux_stats
.
rtp
.
recv
);
B
C_ASSERT_EQUAL
(
marielle_stats
.
rtp
.
sent
,
margaux_stats
.
rtp
.
recv
,
int
,
"%d"
);
marielle_rtp_sent
=
marielle_stats
.
rtp
.
sent
;
audio_stream_stop
(
marielle
);
reset_stats
(
&
marielle_stats
);
reset_stats
(
&
margaux_stats
);
marielle
=
audio_stream_new2
(
MARIELLE_IP
,
MARIELLE_RTP_PORT
,
MARIELLE_RTCP_PORT
);
C
U
_ASSERT_EQUAL
(
audio_stream_start_full
(
marielle
,
profile
,
MARGAUX_IP
,
MARGAUX_RTP_PORT
,
MARGAUX_IP
,
MARGAUX_RTCP_PORT
,
8
,
50
,
hello_file
,
NULL
,
NULL
,
NULL
,
0
),
0
);
B
C_ASSERT_EQUAL
(
audio_stream_start_full
(
marielle
,
profile
,
MARGAUX_IP
,
MARGAUX_RTP_PORT
,
MARGAUX_IP
,
MARGAUX_RTCP_PORT
,
8
,
50
,
hello_file
,
NULL
,
NULL
,
NULL
,
0
),
0
,
int
,
"%d"
);
ms_filter_add_notify_callback
(
marielle
->
soundread
,
notify_cb
,
&
marielle_stats
,
TRUE
);
C
U
_ASSERT_TRUE
(
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
marielle_stats
.
number_of_EndOfFile
,
1
,
12000
));
B
C_ASSERT_TRUE
(
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
marielle_stats
.
number_of_EndOfFile
,
1
,
12000
));
/*make sure packets can cross from sender to receiver*/
wait_for_until
(
&
marielle
->
ms
,
&
margaux
->
ms
,
&
dummy
,
1
,
500
);
...
...
@@ -440,8 +441,8 @@ static void codec_change_for_audio_stream(void) {
audio_stream_get_local_rtp_stats
(
margaux
,
&
margaux_stats
.
rtp
);
/* No packet loss is assumed */
C
U
_ASSERT_EQUAL
(
marielle_stats
.
rtp
.
sent
+
marielle_rtp_sent
,
margaux_stats
.
rtp
.
recv
);
C
U
_ASSERT_EQUAL
(
strcasecmp
(
margaux
->
ms
.
decoder
->
desc
->
enc_fmt
,
"pcma"
),
0
);
B
C_ASSERT_EQUAL
(
marielle_stats
.
rtp
.
sent
+
marielle_rtp_sent
,
margaux_stats
.
rtp
.
recv
,
int
,
"%d"
);
B
C_ASSERT_EQUAL
(
strcasecmp
(
margaux
->
ms
.
decoder
->
desc
->
enc_fmt
,
"pcma"
),
0
,
int
,
"%d"
);
audio_stream_stop
(
marielle
);
audio_stream_stop
(
margaux
);