[pulseaudio-commits] r1874 - /branches/lennart/src/pulsecore/sink.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Sep 20 15:01:10 PDT 2007


Author: lennart
Date: Fri Sep 21 00:01:07 2007
New Revision: 1874

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1874&root=pulseaudio&view=rev
Log:
properly detach/attach when moving sink inputs

Modified:
    branches/lennart/src/pulsecore/sink.c

Modified: branches/lennart/src/pulsecore/sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/sink.c?rev=1874&root=pulseaudio&r1=1873&r2=1874&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/sink.c (original)
+++ branches/lennart/src/pulsecore/sink.c Fri Sep 21 00:01:07 2007
@@ -819,11 +819,19 @@
             if (i->attach)
                 i->attach(i);
 
+            /* If you change anything here, make sure to change the
+             * ghost sink input handling a few lines down at
+             * PA_SINK_MESSAGE_REMOVE_INPUT_AND_BUFFER, too. */
+
             return 0;
         }
 
         case PA_SINK_MESSAGE_REMOVE_INPUT: {
             pa_sink_input *i = PA_SINK_INPUT(userdata);
+
+            /* If you change anything here, make sure to change the
+             * sink input handling a few lines down at
+             * PA_SINK_MESSAGE_REMOVE_INPUT_AND_BUFFER, too. */
 
             if (i->detach)
                 i->detach(i);
@@ -864,6 +872,12 @@
             pa_assert(!info->sink_input->thread_info.sync_next);
             pa_assert(!info->sink_input->thread_info.sync_prev);
 
+            if (info->sink_input->detach)
+                info->sink_input->detach(info->sink_input);
+
+            pa_assert(info->sink_input->thread_info.attached);
+            info->sink_input->thread_info.attached = FALSE;
+
             if (info->ghost_sink_input) {
                 pa_assert(info->buffer_bytes > 0);
                 pa_assert(info->buffer);
@@ -915,6 +929,12 @@
             if (info->ghost_sink_input) {
                 pa_hashmap_put(s->thread_info.inputs, PA_UINT32_TO_PTR(info->ghost_sink_input->index), pa_sink_input_ref(info->ghost_sink_input));
                 info->ghost_sink_input->thread_info.sync_prev = info->ghost_sink_input->thread_info.sync_next = NULL;
+
+                pa_assert(!info->ghost_sink_input->thread_info.attached);
+                info->ghost_sink_input->thread_info.attached = TRUE;
+
+                if (info->ghost_sink_input->attach)
+                    info->ghost_sink_input->attach(info->ghost_sink_input);
             }
 
             return 0;




More information about the pulseaudio-commits mailing list