[pulseaudio-commits] r1584 - in /branches/lennart/src/pulsecore: protocol-native.c protocol-simple.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon Aug 6 14:47:30 PDT 2007


Author: lennart
Date: Mon Aug  6 23:47:29 2007
New Revision: 1584

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1584&root=3Dpulseaudio&vi=
ew=3Drev
Log:
minor fixes and cleanups

Modified:
    branches/lennart/src/pulsecore/protocol-native.c
    branches/lennart/src/pulsecore/protocol-simple.c

Modified: branches/lennart/src/pulsecore/protocol-native.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
protocol-native.c?rev=3D1584&root=3Dpulseaudio&r1=3D1583&r2=3D1584&view=3Dd=
iff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/protocol-native.c (original)
+++ branches/lennart/src/pulsecore/protocol-native.c Mon Aug  6 23:47:29 20=
07
@@ -2710,7 +2710,8 @@
     pa_protocol_native *p =3D userdata;
     connection *c;
     char cname[256], pname[128];
-    =

+
+    pa_assert(s);
     pa_assert(io);
     pa_assert(p);
 =

@@ -2742,9 +2743,7 @@
     c->protocol =3D p;
     pa_iochannel_socket_peer_to_string(io, pname, sizeof(pname));
     pa_snprintf(cname, sizeof(cname), "Native client (%s)", pname);
-    pa_assert(p->core);
     c->client =3D pa_client_new(p->core, __FILE__, cname);
-    pa_assert(c->client);
     c->client->kill =3D client_kill_cb;
     c->client->userdata =3D c;
     c->client->owner =3D p->module;

Modified: branches/lennart/src/pulsecore/protocol-simple.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
protocol-simple.c?rev=3D1584&root=3Dpulseaudio&r1=3D1583&r2=3D1584&view=3Dd=
iff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/protocol-simple.c (original)
+++ branches/lennart/src/pulsecore/protocol-simple.c Mon Aug  6 23:47:29 20=
07
@@ -93,7 +93,7 @@
 enum {
     CONNECTION_MESSAGE_REQUEST_DATA,      /* data requested from sink inpu=
t from the main loop */
     CONNECTION_MESSAGE_POST_DATA,         /* data from source output to ma=
in loop */
-    CONNECTION_MESSAGE_DROP_CONNECTION    /* Please drop a aconnection now=
 */
+    CONNECTION_MESSAGE_UNLINK_CONNECTION    /* Please drop a aconnection n=
ow */
 };
 =

 =

@@ -125,6 +125,11 @@
         c->client =3D NULL;
     }
 =

+    if (c->io) {
+        pa_iochannel_free(c->io);
+        c->io =3D NULL;
+    }
+    =

     pa_assert_se(pa_idxset_remove_by_data(c->protocol->connections, c, NUL=
L) =3D=3D c);
     c->protocol =3D NULL;
     connection_unref(c);
@@ -139,8 +144,6 @@
     if (c->playback.current_memblock)
         pa_memblock_unref(c->playback.current_memblock);
 =

-    if (c->io)
-        pa_iochannel_free(c->io);
     if (c->input_memblockq)
         pa_memblockq_free(c->input_memblockq);
     if (c->output_memblockq)
@@ -155,7 +158,7 @@
     size_t l;
     void *p;
 =

-    pa_assert(c);
+    connection_assert_ref(c);
 =

     if (!c->sink_input || (l =3D pa_atomic_load(&c->playback.missing)) <=
=3D 0)
         return 0;
@@ -205,7 +208,7 @@
     ssize_t r;
     void *p;
 =

-    pa_assert(c);
+    connection_assert_ref(c);
 =

     if (!c->source_output)
         return 0;
@@ -239,7 +242,7 @@
 }
 =

 static void do_work(connection *c) {
-    pa_assert(c);
+    connection_assert_ref(c);
 =

     if (c->dead)
         return;
@@ -287,7 +290,7 @@
             do_work(c);
             break;
 =

-        case CONNECTION_MESSAGE_DROP_CONNECTION:
+        case CONNECTION_MESSAGE_UNLINK_CONNECTION:
             connection_unlink(c);
             break;
     }
@@ -340,12 +343,12 @@
 =

 /* Called from thread context */
 static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) {
-    connection*c;
+    connection *c;
     int r;
 =

     pa_assert(i);
-    c =3D i->userdata;
-    pa_assert(c);
+    c =3D CONNECTION(i->userdata);
+    connection_assert_ref(c);
     pa_assert(chunk);
 =

     r =3D pa_memblockq_peek(c->input_memblockq, chunk);
@@ -353,18 +356,19 @@
 /*     pa_log("peeked %u %i", r >=3D 0 ? chunk->length: 0, r); */
 =

     if (c->dead && r < 0)
-        pa_asyncmsgq_post(c->protocol->core->asyncmsgq, PA_MSGOBJECT(c), C=
ONNECTION_MESSAGE_DROP_CONNECTION, NULL, 0, NULL, NULL);
+        pa_asyncmsgq_post(c->protocol->core->asyncmsgq, PA_MSGOBJECT(c), C=
ONNECTION_MESSAGE_UNLINK_CONNECTION, NULL, 0, NULL, NULL);
 =

     return r;
 }
 =

 /* Called from thread context */
 static void sink_input_drop_cb(pa_sink_input *i, size_t length) {
-    connection*c =3D i->userdata;
+    connection *c;
     size_t old, new;
 =

     pa_assert(i);
-    pa_assert(c);
+    c =3D CONNECTION(i->userdata);
+    connection_assert_ref(c);
     pa_assert(length);
 =

     old =3D pa_memblockq_missing(c->input_memblockq);
@@ -391,7 +395,7 @@
     connection *c;
 =

     pa_assert(o);
-    c =3D o->userdata;
+    c =3D CONNECTION(o->userdata);
     pa_assert(c);
     pa_assert(chunk);
 =

@@ -433,8 +437,8 @@
 static void io_callback(pa_iochannel*io, void *userdata) {
     connection *c =3D CONNECTION(userdata);
 =

+    connection_assert_ref(c);
     pa_assert(io);
-    pa_assert(c);
 =

     do_work(c);
 }
@@ -507,7 +511,6 @@
                 (size_t) -1,
                 l/PLAYBACK_BUFFER_FRAGMENTS,
                 NULL);
-        pa_assert(c->input_memblockq);
         pa_iochannel_socket_set_rcvbuf(io, l/PLAYBACK_BUFFER_FRAGMENTS*5);
         c->playback.fragment_size =3D l/PLAYBACK_BUFFER_FRAGMENTS;
 =





More information about the pulseaudio-commits mailing list