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
0fa81fc7
Commit
0fa81fc7
authored
Sep 01, 2017
by
Simon Morlat
Browse files
Clear refcounting of LinphoneVideoDefinition object.
parent
e414951c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
15 deletions
+27
-15
coreapi/factory.c
coreapi/factory.c
+9
-7
coreapi/linphonecall.c
coreapi/linphonecall.c
+4
-4
coreapi/video_definition.c
coreapi/video_definition.c
+14
-4
No files found.
coreapi/factory.c
View file @
0fa81fc7
...
...
@@ -94,7 +94,7 @@ static void _linphone_factory_destroying_cb(void) {
#define ADD_SUPPORTED_VIDEO_DEFINITION(factory, width, height, name) \
(factory)->supported_video_definitions = bctbx_list_append((factory)->supported_video_definitions, \
linphone_video_definition_ref(
linphone_video_definition_new(width, height, name))
)
linphone_video_definition_new(width, height, name))
static
void
initialize_supported_video_definitions
(
LinphoneFactory
*
factory
)
{
#if !defined(__ANDROID__) && !TARGET_OS_IPHONE
...
...
@@ -179,7 +179,8 @@ LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory) {
}
LinphoneVideoDefinition
*
linphone_factory_create_video_definition
(
const
LinphoneFactory
*
factory
,
unsigned
int
width
,
unsigned
int
height
)
{
return
linphone_video_definition_ref
(
linphone_video_definition_new
(
width
,
height
,
NULL
));
LinphoneVideoDefinition
*
supported
=
linphone_factory_find_supported_video_definition
(
factory
,
width
,
height
);
return
supported
?
linphone_video_definition_clone
(
supported
)
:
linphone_video_definition_new
(
width
,
height
,
NULL
);
}
LinphoneVideoDefinition
*
linphone_factory_create_video_definition_from_name
(
const
LinphoneFactory
*
factory
,
const
char
*
name
)
{
...
...
@@ -201,16 +202,17 @@ LinphoneVideoDefinition * linphone_factory_find_supported_video_definition(const
const
bctbx_list_t
*
item
;
const
bctbx_list_t
*
supported
=
linphone_factory_get_supported_video_definitions
(
factory
);
LinphoneVideoDefinition
*
searched_vdef
=
linphone_video_definition_new
(
width
,
height
,
NULL
);
LinphoneVideoDefinition
*
found
=
NULL
;
for
(
item
=
supported
;
item
!=
NULL
;
item
=
bctbx_list_next
(
item
))
{
LinphoneVideoDefinition
*
svdef
=
(
LinphoneVideoDefinition
*
)
bctbx_list_get_data
(
item
);
if
(
linphone_video_definition_equals
(
svdef
,
searched_vdef
))
{
linphone_video_definition_unref
(
searched_
vdef
)
;
return
linphone_video_definition_clone
(
svdef
)
;
found
=
s
vdef
;
break
;
}
}
return
searched_vdef
;
linphone_video_definition_unref
(
searched_vdef
);
return
found
;
}
LinphoneVideoDefinition
*
linphone_factory_find_supported_video_definition_by_name
(
const
LinphoneFactory
*
factory
,
const
char
*
name
)
{
...
...
@@ -220,7 +222,7 @@ LinphoneVideoDefinition * linphone_factory_find_supported_video_definition_by_na
for
(
item
=
supported
;
item
!=
NULL
;
item
=
bctbx_list_next
(
item
))
{
LinphoneVideoDefinition
*
svdef
=
(
LinphoneVideoDefinition
*
)
bctbx_list_get_data
(
item
);
if
(
strcmp
(
linphone_video_definition_get_name
(
svdef
),
name
)
==
0
)
{
return
linphone_video_definition_clone
(
svdef
)
;
return
svdef
;
}
}
return
NULL
;
...
...
coreapi/linphonecall.c
View file @
0fa81fc7
...
...
@@ -2067,10 +2067,10 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
if
(
vstream
!=
NULL
)
{
call
->
current_params
->
sent_vsize
=
video_stream_get_sent_video_size
(
vstream
);
call
->
current_params
->
recv_vsize
=
video_stream_get_received_video_size
(
vstream
);
call
->
current_params
->
sent_vdef
=
linphone_
video_definition_ref
(
linphone_factory_find_suppor
te
d
_video_definition
(
linphone_factory_get
(),
call
->
current_params
->
sent_vsize
.
width
,
call
->
current_params
->
sent_vsize
.
height
)
)
;
call
->
current_params
->
recv_vdef
=
linphone_
video_definition_ref
(
linphone_factory_find_suppor
te
d
_video_definition
(
linphone_factory_get
(),
call
->
current_params
->
recv_vsize
.
width
,
call
->
current_params
->
recv_vsize
.
height
)
)
;
call
->
current_params
->
sent_vdef
=
linphone_
factory_crea
te_video_definition
(
linphone_factory_get
(),
call
->
current_params
->
sent_vsize
.
width
,
call
->
current_params
->
sent_vsize
.
height
);
call
->
current_params
->
recv_vdef
=
linphone_
factory_crea
te_video_definition
(
linphone_factory_get
(),
call
->
current_params
->
recv_vsize
.
width
,
call
->
current_params
->
recv_vsize
.
height
);
call
->
current_params
->
sent_fps
=
video_stream_get_sent_framerate
(
vstream
);
call
->
current_params
->
received_fps
=
video_stream_get_received_framerate
(
vstream
);
}
...
...
coreapi/video_definition.c
View file @
0fa81fc7
...
...
@@ -27,13 +27,23 @@ static void linphone_video_definition_destroy(LinphoneVideoDefinition *vdef) {
if
(
vdef
->
name
)
bctbx_free
(
vdef
->
name
);
}
static
void
_linphone_video_definition_clone
(
LinphoneVideoDefinition
*
obj
,
const
LinphoneVideoDefinition
*
orig
){
obj
->
name
=
bctbx_strdup
(
orig
->
name
);
obj
->
width
=
orig
->
width
;
obj
->
height
=
orig
->
height
;
}
belle_sip_error_code
_linphone_video_definition_marshal
(
const
LinphoneVideoDefinition
*
obj
,
char
*
buff
,
size_t
buff_size
,
size_t
*
offset
){
return
belle_sip_snprintf
(
buff
,
buff_size
,
offset
,
"%s"
,
obj
->
name
);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES
(
LinphoneVideoDefinition
);
BELLE_SIP_INSTANCIATE_VPTR
(
LinphoneVideoDefinition
,
belle_sip_object_t
,
(
belle_sip_object_destroy_t
)
linphone_video_definition_destroy
,
NULL
,
// clone
NULL
,
// marshal
TRU
E
(
belle_sip_object_clone_t
)
_linphone_video_definition_clone
,
// clone
(
belle_sip_object_marshal_t
)
_linphone_video_definition_marshal
,
// marshal
FALS
E
);
...
...
@@ -67,7 +77,7 @@ void linphone_video_definition_set_user_data(LinphoneVideoDefinition *vdef, void
}
LinphoneVideoDefinition
*
linphone_video_definition_clone
(
const
LinphoneVideoDefinition
*
vdef
)
{
return
l
inphone
_v
ideo
_d
efinition
_new
(
linphone_video_definition_get_width
(
vdef
),
linphone_video_definition_get_height
(
vdef
),
linphone_video_definition_get_name
(
vdef
)
)
;
return
(
L
inphone
V
ideo
D
efinition
*
)
belle_sip_object_clone
((
belle_sip_object_t
*
)
vdef
);
}
unsigned
int
linphone_video_definition_get_width
(
const
LinphoneVideoDefinition
*
vdef
)
{
...
...
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