summaryrefslogtreecommitdiffstats
path: root/switch.c
diff options
context:
space:
mode:
authorManuel Bachmann <manuel.bachmann@iot.bzh>2016-06-13 10:11:28 +0200
committerYannick Gicquel <yannick.gicquel@iot.bzh>2016-10-11 17:09:07 +0200
commit6fc3e02df9de8347eb76fdfd26ed781686d37b6c (patch)
treea291b1fa88b957941e9abd3baee01df26ebf4177 /switch.c
parentd126c05ba201b0fd6daabf7c03d05da3db1b2957 (diff)
Clean up node status after sink_input unlink
We now unload all modules associated with a node when it disappears. Change-Id: I6d2055d546c9cc1b1967f85c973eafcc216bc91f Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
Diffstat (limited to 'switch.c')
-rw-r--r--switch.c44
1 files changed, 17 insertions, 27 deletions
diff --git a/switch.c b/switch.c
index 5b77180..05386a0 100644
--- a/switch.c
+++ b/switch.c
@@ -135,7 +135,7 @@ bool agl_switch_setup_link (struct userdata *u, agl_node *from, agl_node *to, bo
/* ONLY "FROM" IS DEFINED */
else {
- /* only works with a device, use default input prerouting - TODO */
+ /* only works with a stream, use default input prerouting */
if (from->implement == agl_device) {
pa_log_debug ("default routing for a device input is not supported yet");
return false;
@@ -165,38 +165,28 @@ bool agl_switch_teardown_link (struct userdata *u, agl_node *from, agl_node *to)
pa_assert (u);
pa_assert_se (core = u->core);
- pa_assert (from || from->direction == agl_input);
- pa_assert (to || to->direction == agl_output);
- switch (from->implement) {
- case agl_stream:
- switch (to->implement) {
- /* STREAM TO STREAM : NOT IMPLEMENTED */
- case agl_stream:
- pa_log_debug ("routing to streams is not implemented yet");
- break;
- /* STREAM TO DEVICE : NOT OK */
- case agl_device:
- //if (!teardown_explicit_stream2dev_link (u, from, to))
- // return false;
- break;
- default:
- pa_log ("can't teardown link: invalid sink node");
- return false;
- }
- break;
+ pa_assert (from || to);
- case agl_device:
- /* DEVICE TO STREAM OR DEVICE TO DEVICE : NOT HANDLED */
- pa_log_debug ("input device routing is not implemented yet");
- break;
+ /* "TO" IS DEFINED */
+ if (to) {
- default:
- pa_log ("can't teardown link: invalid source node");
+ }
+ /* ONLY "FROM" IS DEFINED */
+ else {
+ /* only works with a stream */
+ if (from->implement == agl_device) {
+ pa_log_debug ("default routing for a device input is not supported");
return false;
+ }
+ /* (the rest supposes "from->implement == agl_stream") */
+ if (from->loopnode)
+ pa_loopnode_destroy (u, from->loopnode);
+ if (from->nullsink)
+ pa_utils_destroy_null_sink (u, from->nullsink);
}
- pa_log_debug("link %s => %s is torn down", from->amname, to->amname);
+ //pa_log_debug("link %s => %s is torn down", from->amname, to->amname);
return true;
}