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
75732fdd
Commit
75732fdd
authored
Sep 11, 2014
by
Gautier Pelloux-Prayer
Browse files
Fix framework test: do not recreate factory if it was destroyed (due to invalid initialization)
parent
e72c8b0c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
13 deletions
+23
-13
include/mediastreamer2/msfactory.h
include/mediastreamer2/msfactory.h
+5
-0
src/base/mscommon.c
src/base/mscommon.c
+9
-5
src/base/msfactory.c
src/base/msfactory.c
+8
-5
tester/mediastreamer2_framework_tester.c
tester/mediastreamer2_framework_tester.c
+1
-3
No files found.
include/mediastreamer2/msfactory.h
View file @
75732fdd
...
...
@@ -41,6 +41,11 @@ typedef struct _MSFactory MSFactory;
**/
MS2_PUBLIC
MSFactory
*
ms_factory_new
(
void
);
/**
* Create the factory default callback.
**/
MS2_PUBLIC
MSFactory
*
ms_factory_create_fallback
(
void
);
/**
* Used by the legacy functions before MSFactory was added.
* Do not use in an application.
...
...
src/base/mscommon.c
View file @
75732fdd
...
...
@@ -284,16 +284,18 @@ static int ms_base_ref=0;
static
int
ms_plugins_ref
=
0
;
void
ms_base_init
(){
if
(
ms_base_ref
++
>
0
)
{
ms_base_ref
++
;
if
(
ms_base_ref
>
1
)
{
ms_message
(
"Skiping ms_base_init, because [%i] ref"
,
ms_base_ref
);
return
;
}
ms_factory_create_fallback
();
ms_factory_get_fallback
();
}
void
ms_base_exit
(){
if
(
--
ms_base_ref
>
0
)
{
--
ms_base_ref
;
if
(
ms_base_ref
>
0
)
{
ms_message
(
"Skiping ms_base_exit, still [%i] ref"
,
ms_base_ref
);
return
;
}
...
...
@@ -301,7 +303,8 @@ void ms_base_exit(){
}
void
ms_plugins_init
(
void
)
{
if
(
ms_plugins_ref
++
>
0
)
{
ms_plugins_ref
++
;
if
(
ms_plugins_ref
>
1
)
{
ms_message
(
"Skiping ms_plugins_init, because [%i] ref"
,
ms_plugins_ref
);
return
;
}
...
...
@@ -309,7 +312,8 @@ void ms_plugins_init(void) {
}
void
ms_plugins_exit
(
void
)
{
if
(
--
ms_plugins_ref
>
0
)
{
--
ms_plugins_ref
;
if
(
ms_plugins_ref
>
0
)
{
ms_message
(
"Skiping ms_plugins_exit, still [%i] ref"
,
ms_plugins_ref
);
return
;
}
...
...
src/base/msfactory.c
View file @
75732fdd
...
...
@@ -124,9 +124,6 @@ static MSFilterStats *find_or_create_stats(MSFactory *factory, MSFilterDesc *des
* Do not use in an application.
**/
MSFactory
*
ms_factory_get_fallback
(
void
){
if
(
fallback_factory
==
NULL
){
fallback_factory
=
ms_factory_new
();
}
return
fallback_factory
;
}
...
...
@@ -167,6 +164,12 @@ void ms_factory_init(MSFactory *obj){
ms_message
(
"ms_factory_init() done"
);
}
MSFactory
*
ms_factory_create_fallback
(
void
){
if
(
fallback_factory
==
NULL
){
fallback_factory
=
ms_factory_new
();
}
return
fallback_factory
;
}
MSFactory
*
ms_factory_new
(
void
){
MSFactory
*
obj
=
ms_new0
(
MSFactory
,
1
);
...
...
@@ -336,7 +339,7 @@ MSFilterDesc *ms_factory_lookup_filter_by_name(MSFactory* factory, const char *f
MSFilterDesc
*
ms_factory_lookup_filter_by_id
(
MSFactory
*
factory
,
MSFilterId
id
){
MSList
*
elem
;
for
(
elem
=
factory
->
desc_list
;
elem
!=
NULL
;
elem
=
ms_list_next
(
elem
)){
MSFilterDesc
*
desc
=
(
MSFilterDesc
*
)
elem
->
data
;
if
(
desc
->
id
==
id
){
...
...
@@ -429,7 +432,7 @@ int ms_factory_load_plugins(MSFactory *factory, const char *dir){
BOOL
fFinished
=
FALSE
;
const
char
*
tmp
=
getenv
(
"DEBUG"
);
BOOL
debug
=
(
tmp
!=
NULL
&&
atoi
(
tmp
)
==
1
);
snprintf
(
szDirPath
,
sizeof
(
szDirPath
),
"%s"
,
dir
);
// Start searching for .dll files in the current directory.
...
...
tester/mediastreamer2_framework_tester.c
View file @
75732fdd
...
...
@@ -63,9 +63,7 @@ static void filter_register_tester(void) {
ms_filter_destroy
(
filter
);
ms_exit
();
CU_ASSERT_PTR_NULL
(
ms_filter_lookup_by_name
(
"MSVoidSource"
));
filter
=
ms_filter_create_decoder
(
"pcma"
);
CU_ASSERT_PTR_NULL
(
filter
);
CU_ASSERT_PTR_NULL
(
ms_factory_get_fallback
());
}
static
test_t
tests
[]
=
{
...
...
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