[pulseaudio-commits] r1212 - in /trunk/src/pulsecore: sink-input.c sink.c source-output.c source.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri Aug 11 19:19:37 PDT 2006


Author: lennart
Date: Sat Aug 12 04:19:36 2006
New Revision: 1212

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1212&root=pulseaudio&view=rev
Log:
clean up event generation a little: suppress unnecessary events and generate new ones on owner change

Modified:
    trunk/src/pulsecore/sink-input.c
    trunk/src/pulsecore/sink.c
    trunk/src/pulsecore/source-output.c
    trunk/src/pulsecore/source.c

Modified: trunk/src/pulsecore/sink-input.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/sink-input.c?rev=1212&root=pulseaudio&r1=1211&r2=1212&view=diff
==============================================================================
--- trunk/src/pulsecore/sink-input.c (original)
+++ trunk/src/pulsecore/sink-input.c Sat Aug 12 04:19:36 2006
@@ -437,6 +437,12 @@
     assert(i);
     assert(i->ref >= 1);
 
+    if (!i->name && !name)
+        return;
+
+    if (i->name && name && !strcmp(i->name, name))
+        return;
+    
     pa_xfree(i->name);
     i->name = pa_xstrdup(name);
 

Modified: trunk/src/pulsecore/sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/sink.c?rev=1212&root=pulseaudio&r1=1211&r2=1212&view=diff
==============================================================================
--- trunk/src/pulsecore/sink.c (original)
+++ trunk/src/pulsecore/sink.c Sat Aug 12 04:19:36 2006
@@ -446,11 +446,16 @@
 void pa_sink_set_owner(pa_sink *s, pa_module *m) {
     assert(s);
     assert(s->ref >= 1);
-           
+
+    if (s->owner == m)
+        return;
+    
     s->owner = m;
 
     if (s->monitor_source)
         pa_source_set_owner(s->monitor_source, m);
+
+    pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
 }
 
 void pa_sink_set_volume(pa_sink *s, pa_mixer_t m, const pa_cvolume *volume) {

Modified: trunk/src/pulsecore/source-output.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/source-output.c?rev=1212&root=pulseaudio&r1=1211&r2=1212&view=diff
==============================================================================
--- trunk/src/pulsecore/source-output.c (original)
+++ trunk/src/pulsecore/source-output.c Sat Aug 12 04:19:36 2006
@@ -208,6 +208,12 @@
 void pa_source_output_set_name(pa_source_output *o, const char *name) {
     assert(o);
     assert(o->ref >= 1);
+
+    if (!o->name && !name)
+        return;
+
+    if (o->name && name && !strcmp(o->name, name))
+        return;
     
     pa_xfree(o->name);
     o->name = pa_xstrdup(name);

Modified: trunk/src/pulsecore/source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/source.c?rev=1212&root=pulseaudio&r1=1211&r2=1212&view=diff
==============================================================================
--- trunk/src/pulsecore/source.c (original)
+++ trunk/src/pulsecore/source.c Sat Aug 12 04:19:36 2006
@@ -225,8 +225,12 @@
 void pa_source_set_owner(pa_source *s, pa_module *m) {
     assert(s);
     assert(s->ref >= 1);
+
+    if (m == s->owner)
+        return;
     
     s->owner = m;
+    pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
 }
 
 pa_usec_t pa_source_get_latency(pa_source *s) {




More information about the pulseaudio-commits mailing list