Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wireplumber
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
wireplumber
Commits
3cecccd6
Commit
3cecccd6
authored
5 years ago
by
Julian Bouzas
Browse files
Options
Downloads
Patches
Plain Diff
endpoint: allow derived classes of endpoint-link to finish async construction
parent
12310019
No related branches found
Branches containing commit
Tags
debian/2%1.20.11-1+deb11u1
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/wp/endpoint.c
+6
-23
6 additions, 23 deletions
lib/wp/endpoint.c
modules/module-pipewire/simple-endpoint-link.c
+48
-3
48 additions, 3 deletions
modules/module-pipewire/simple-endpoint-link.c
with
54 additions
and
26 deletions
lib/wp/endpoint.c
+
6
−
23
View file @
3cecccd6
...
...
@@ -737,9 +737,6 @@ wp_endpoint_get_links (WpEndpoint * self)
typedef
struct
_WpEndpointLinkPrivate
WpEndpointLinkPrivate
;
struct
_WpEndpointLinkPrivate
{
/* The task to signal the endpoint link is initialized */
GTask
*
init_task
;
GWeakRef
src
;
guint32
src_stream
;
GWeakRef
sink
;
...
...
@@ -768,9 +765,6 @@ endpoint_link_finalize (GObject * object)
WpEndpointLinkPrivate
*
priv
=
wp_endpoint_link_get_instance_private
(
WP_ENDPOINT_LINK
(
object
));
/* Destroy the init task */
g_clear_object
(
&
priv
->
init_task
);
/* Clear the endpoint weak reaferences */
g_weak_ref_clear
(
&
priv
->
src
);
g_weak_ref_clear
(
&
priv
->
sink
);
...
...
@@ -837,34 +831,27 @@ wp_endpoint_link_init_async (GAsyncInitable *initable, int io_priority,
wp_endpoint_link_get_instance_private
(
WP_ENDPOINT_LINK
(
initable
));
g_autoptr
(
WpEndpoint
)
src
=
g_weak_ref_get
(
&
priv
->
src
);
g_autoptr
(
WpEndpoint
)
sink
=
g_weak_ref_get
(
&
priv
->
sink
);
g_autoptr
(
GError
)
error
=
NULL
;
g_autoptr
(
GVariant
)
src_props
=
NULL
;
g_autoptr
(
GVariant
)
sink_props
=
NULL
;
WpEndpointPrivate
*
endpoint_priv
;
/* Create the async task */
priv
->
init_task
=
g_task_new
(
initable
,
cancellable
,
callback
,
data
);
/* Prepare the endpoints */
if
(
!
WP_ENDPOINT_GET_CLASS
(
src
)
->
prepare_link
(
src
,
priv
->
src_stream
,
link
,
&
src_props
,
&
error
))
{
g_task_return_error
(
priv
->
init_task
,
error
);
g_clear_object
(
&
priv
->
init_task
);
&
src_props
,
NULL
))
{
g_critical
(
"Failed to prepare link on source endpoint"
);
return
;
}
if
(
!
WP_ENDPOINT_GET_CLASS
(
sink
)
->
prepare_link
(
sink
,
priv
->
sink_stream
,
link
,
&
sink_props
,
&
error
))
{
g_task_return_error
(
priv
->
init_task
,
error
);
g_clear_object
(
&
priv
->
init_task
);
link
,
&
sink_props
,
NULL
))
{
g_critical
(
"Failed to prepare link on sink endpoint"
);
return
;
}
/* Create the link */
g_return_if_fail
(
WP_ENDPOINT_LINK_GET_CLASS
(
link
)
->
create
);
if
(
!
WP_ENDPOINT_LINK_GET_CLASS
(
link
)
->
create
(
link
,
src_props
,
sink_props
,
&
error
))
{
g_task_return_error
(
priv
->
init_task
,
error
);
g_clear_object
(
&
priv
->
init_task
);
sink_props
,
NULL
))
{
g_critical
(
"Failed to create link in src and sink endpoints"
);
return
;
}
...
...
@@ -873,10 +860,6 @@ wp_endpoint_link_init_async (GAsyncInitable *initable, int io_priority,
g_ptr_array_add
(
endpoint_priv
->
links
,
g_object_ref
(
link
));
endpoint_priv
=
wp_endpoint_get_instance_private
(
sink
);
g_ptr_array_add
(
endpoint_priv
->
links
,
g_object_ref
(
link
));
/* Finish the creation of the endpoint */
g_task_return_boolean
(
priv
->
init_task
,
TRUE
);
g_clear_object
(
&
priv
->
init_task
);
}
static
gboolean
...
...
This diff is collapsed.
Click to expand it.
modules/module-pipewire/simple-endpoint-link.c
+
48
−
3
View file @
3cecccd6
...
...
@@ -27,8 +27,11 @@ struct _WpPipewireSimpleEndpointLink
{
WpEndpointLink
parent
;
/*
The wireplumber core
*/
/*
Props
*/
GWeakRef
core
;
/* The task to signal the simple endpoint link is initialized */
GTask
*
init_task
;
};
enum
{
...
...
@@ -36,11 +39,50 @@ enum {
PROP_CORE
,
};
static
GAsyncInitableIface
*
wp_simple_endpoint_link_parent_interface
=
NULL
;
static
void
wp_simple_endpoint_link_async_initable_init
(
gpointer
iface
,
gpointer
iface_data
);
G_DECLARE_FINAL_TYPE
(
WpPipewireSimpleEndpointLink
,
simple_endpoint_link
,
WP_PIPEWIRE
,
SIMPLE_ENDPOINT_LINK
,
WpEndpointLink
)
G_DEFINE_TYPE
(
WpPipewireSimpleEndpointLink
,
simple_endpoint_link
,
WP_TYPE_ENDPOINT_LINK
)
G_DEFINE_TYPE_WITH_CODE
(
WpPipewireSimpleEndpointLink
,
simple_endpoint_link
,
WP_TYPE_ENDPOINT_LINK
,
G_IMPLEMENT_INTERFACE
(
G_TYPE_ASYNC_INITABLE
,
wp_simple_endpoint_link_async_initable_init
))
static
void
wp_simple_endpoint_link_init_async
(
GAsyncInitable
*
initable
,
int
io_priority
,
GCancellable
*
cancellable
,
GAsyncReadyCallback
callback
,
gpointer
data
)
{
WpPipewireSimpleEndpointLink
*
self
=
WP_PIPEWIRE_SIMPLE_ENDPOINT_LINK
(
initable
);
/* Create the async task */
self
->
init_task
=
g_task_new
(
initable
,
cancellable
,
callback
,
data
);
/* Call the parent interface */
wp_simple_endpoint_link_parent_interface
->
init_async
(
initable
,
io_priority
,
cancellable
,
callback
,
data
);
/* Finish the creation of the endpoint */
g_task_return_boolean
(
self
->
init_task
,
TRUE
);
g_clear_object
(
&
self
->
init_task
);
}
static
void
wp_simple_endpoint_link_async_initable_init
(
gpointer
iface
,
gpointer
iface_data
)
{
GAsyncInitableIface
*
ai_iface
=
iface
;
/* Set the parent interface */
wp_simple_endpoint_link_parent_interface
=
g_type_interface_peek_parent
(
iface
);
/* Only set the init_async */
ai_iface
->
init_async
=
wp_simple_endpoint_link_init_async
;
}
static
void
simple_endpoint_link_init
(
WpPipewireSimpleEndpointLink
*
self
)
...
...
@@ -54,6 +96,9 @@ simple_endpoint_link_finalize (GObject * object)
{
WpPipewireSimpleEndpointLink
*
self
=
WP_PIPEWIRE_SIMPLE_ENDPOINT_LINK
(
object
);
/* Destroy the init task */
g_clear_object
(
&
self
->
init_task
);
/* Clear the core weak reference */
g_weak_ref_clear
(
&
self
->
core
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment