[PATCH 11/15] sink-input, source-output: Delete edge when detaching a stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a temporary hack. The next step is to create edges during the
creation of streams. Edges should also be created when moving streams,
but that's a more complex operation, and will be implemented later.
The purpose of this hack is to clean up the edge when it doesn't point
to the right device any more. Later, when the high level "move stream"
operation is reimplemented in terms of node and edge operations, the
edge deletion will be done in a different place.
---
 src/pulsecore/sink-input.c    | 8 ++++++++
 src/pulsecore/source-output.c | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index f10268c..922aaaf 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1690,6 +1690,7 @@ int pa_sink_input_start_move(pa_sink_input *i) {
     struct volume_factor_entry *v;
     void *state = NULL;
     int r;
+    pa_edge *edge;
 
     pa_sink_input_assert_ref(i);
     pa_assert_ctl_context();
@@ -1710,6 +1711,13 @@ int pa_sink_input_start_move(pa_sink_input *i) {
     }
     pa_assert(pa_idxset_isempty(i->direct_outputs));
 
+    /* FIXME: This is a temporary hack, we shouldn't delete the edge here. Sink
+     * inputs are supposed to get detached due to deleting edges, not the other
+     * way around. */
+    edge = pa_core_get_edge(i->core, i->node, pa_sink_get_node(i->sink));
+    if (edge)
+        pa_core_delete_edge(i->core, edge);
+
     pa_idxset_remove_by_data(i->sink->inputs, i, NULL);
 
     if (pa_sink_input_get_state(i) == PA_SINK_INPUT_CORKED)
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 942d285..6c3d085 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -1350,6 +1350,7 @@ bool pa_source_output_may_move_to(pa_source_output *o, pa_source *dest) {
 int pa_source_output_start_move(pa_source_output *o) {
     pa_source *origin;
     int r;
+    pa_edge *edge;
 
     pa_source_output_assert_ref(o);
     pa_assert_ctl_context();
@@ -1364,6 +1365,13 @@ int pa_source_output_start_move(pa_source_output *o) {
 
     origin = o->source;
 
+    /* FIXME: This is a temporary hack, we shouldn't delete the edge here.
+     * Source outputs are supposed to get detached due to deleting edges, not
+     * the other way around. */
+    edge = pa_core_get_edge(o->core, o->node, pa_source_get_node(o->source));
+    if (edge)
+        pa_core_delete_edge(o->core, edge);
+
     pa_idxset_remove_by_data(o->source->outputs, o, NULL);
 
     if (pa_source_output_get_state(o) == PA_SOURCE_OUTPUT_CORKED)
-- 
1.8.3.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux