Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
mediastreamer2
Commits
5fff19f9
Commit
5fff19f9
authored
Feb 28, 2013
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use test suite init and cleanup functions.
parent
d44393f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
9 deletions
+22
-9
tester/mediastreamer2_dtmfgen_tester.c
tester/mediastreamer2_dtmfgen_tester.c
+16
-8
tester/mediastreamer2_tester.c
tester/mediastreamer2_tester.c
+1
-1
tester/mediastreamer2_tester.h
tester/mediastreamer2_tester.h
+5
-0
No files found.
tester/mediastreamer2_dtmfgen_tester.c
View file @
5fff19f9
...
...
@@ -52,21 +52,31 @@ static MSFilter *rtpsend = NULL;
static
unsigned
char
tone_detected
;
static
int
dtmfgen_tester_init
(
void
)
{
ms_init
();
ms_filter_enable_statistics
(
TRUE
);
ortp_init
();
return
0
;
}
static
int
dtmfgen_tester_cleanup
(
void
)
{
ms_exit
();
return
0
;
}
static
MSTicker
*
create_ticker
(
void
)
{
MSTickerParams
params
=
{
0
};
MSTickerParams
params
=
{
0
};
params
.
name
=
"Tester MSTicker"
;
params
.
prio
=
MS_TICKER_PRIO_NORMAL
;
return
ms_ticker_new_with_params
(
&
params
);
}
static
void
tone_detected_cb
(
void
*
data
,
MSFilter
*
f
,
unsigned
int
event_id
,
MSToneDetectorEvent
*
ev
)
{
MS_UNUSED
(
data
),
MS_UNUSED
(
f
),
MS_UNUSED
(
event_id
),
MS_UNUSED
(
ev
);
tone_detected
=
TRUE
;
}
static
void
common_init
(
void
)
{
ms_init
();
ms_filter_enable_statistics
(
TRUE
);
ms_filter_reset_statistics
();
ticker
=
create_ticker
();
...
...
@@ -88,8 +98,6 @@ static void common_uninit(void) {
ms_filter_destroy
(
dtmfgen
);
ms_filter_destroy
(
fileplay
);
ms_ticker_destroy
(
ticker
);
ms_exit
();
}
static
void
tone_generation_loop
(
void
)
{
...
...
@@ -159,13 +167,11 @@ static void dtmfgen_codec(void) {
common_uninit
();
}
static
void
dtmfgen_rtp
(
void
)
{
MSConnectionHelper
h
;
RtpSession
*
rtps
;
common_init
();
ortp_init
();
rtps
=
create_duplex_rtpsession
(
50060
,
0
,
FALSE
);
rtp_session_set_remote_addr_full
(
rtps
,
"127.0.0.1"
,
50060
,
NULL
,
0
);
rtp_session_set_payload_type
(
rtps
,
8
);
...
...
@@ -223,6 +229,8 @@ test_t dtmfgen_tests[] = {
test_suite_t
dtmfgen_test_suite
=
{
"dtmfgen"
,
dtmfgen_tester_init
,
dtmfgen_tester_cleanup
,
sizeof
(
dtmfgen_tests
)
/
sizeof
(
dtmfgen_tests
[
0
]),
dtmfgen_tests
};
tester/mediastreamer2_tester.c
View file @
5fff19f9
...
...
@@ -53,7 +53,7 @@ static void add_test_suite(test_suite_t *suite) {
static
int
run_test_suite
(
test_suite_t
*
suite
)
{
int
i
;
CU_pSuite
pSuite
=
CU_add_suite
(
suite
->
name
,
NULL
,
NULL
);
CU_pSuite
pSuite
=
CU_add_suite
(
suite
->
name
,
suite
->
init_func
,
suite
->
cleanup_func
);
for
(
i
=
0
;
i
<
suite
->
nb_tests
;
i
++
)
{
if
(
NULL
==
CU_add_test
(
pSuite
,
suite
->
tests
[
i
].
name
,
suite
->
tests
[
i
].
func
))
{
...
...
tester/mediastreamer2_tester.h
View file @
5fff19f9
...
...
@@ -21,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define _MEDIASTREAMER2_TESTER_H
#include "CUnit/Basic.h"
typedef
void
(
*
test_function_t
)(
void
);
typedef
int
(
*
test_suite_function_t
)(
const
char
*
name
);
...
...
@@ -31,6 +34,8 @@ typedef struct {
typedef
struct
{
const
char
*
name
;
CU_InitializeFunc
init_func
;
CU_CleanupFunc
cleanup_func
;
int
nb_tests
;
test_t
*
tests
;
}
test_suite_t
;
...
...
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