[pulseaudio-commits] r1076 - /trunk/src/pulsecore/avahi-wrap.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Jul 13 16:12:51 PDT 2006


Author: lennart
Date: Fri Jul 14 01:12:50 2006
New Revision: 1076

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1076&root=pulseaudio&view=rev
Log:
support time events with NULL timevals which are OK in avahi, but not in PA. This makes padevchooser actually work on top of the new avahi browsing stuff

Modified:
    trunk/src/pulsecore/avahi-wrap.c

Modified: trunk/src/pulsecore/avahi-wrap.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/avahi-wrap.c?rev=1076&root=pulseaudio&r1=1075&r2=1076&view=diff
==============================================================================
--- trunk/src/pulsecore/avahi-wrap.c (original)
+++ trunk/src/pulsecore/avahi-wrap.c Fri Jul 14 01:12:50 2006
@@ -139,7 +139,8 @@
     t->avahi_poll = p;
     t->callback = callback;
     t->userdata = userdata;
-    t->time_event = p->mainloop->time_new(p->mainloop, tv, timeout_callback, t);
+    
+    t->time_event = tv ? p->mainloop->time_new(p->mainloop, tv, timeout_callback, t) : NULL;
 
     return t;
 }
@@ -147,13 +148,21 @@
 static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
     assert(t);
 
-    t->avahi_poll->mainloop->time_restart(t->time_event, tv);
+    if (t->time_event && tv)
+        t->avahi_poll->mainloop->time_restart(t->time_event, tv);
+    else if (!t->time_event && tv)
+        t->time_event = t->avahi_poll->mainloop->time_new(t->avahi_poll->mainloop, tv, timeout_callback, t);
+    else if (t->time_event && !tv) {
+        t->avahi_poll->mainloop->time_free(t->time_event);
+        t->time_event = NULL;
+    }
 }
      
 static void timeout_free(AvahiTimeout *t) {
     assert(t);
 
-    t->avahi_poll->mainloop->time_free(t->time_event);
+    if (t->time_event)
+        t->avahi_poll->mainloop->time_free(t->time_event);
     pa_xfree(t);
 }
 




More information about the pulseaudio-commits mailing list