From 010378643e89e2ca4ea3502cb7dc6d8e16480832 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 27 Jun 2004 20:00:26 +0000 Subject: make native playback work git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@38 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/iochannel.c | 2 +- src/ioline.c | 29 +++++++++++++++++------------ src/polyp.c | 4 ++-- src/protocol-native.c | 4 ++-- 4 files changed, 22 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/iochannel.c b/src/iochannel.c index 910b7e0b..fa55875f 100644 --- a/src/iochannel.c +++ b/src/iochannel.c @@ -116,7 +116,7 @@ void iochannel_free(struct iochannel*io) { if (io->input_source) io->mainloop->cancel_io(io->mainloop, io->input_source); - if (io->output_source && io->output_source != io->input_source) + if (io->output_source && (io->output_source != io->input_source)) io->mainloop->cancel_io(io->mainloop, io->output_source); free(io); diff --git a/src/ioline.c b/src/ioline.c index c37737a6..ada9cee0 100644 --- a/src/ioline.c +++ b/src/ioline.c @@ -98,7 +98,7 @@ void ioline_set_callback(struct ioline*l, void (*callback)(struct ioline*io, con static int do_read(struct ioline *l) { ssize_t r; size_t m, len; - char *p, *e; + char *e; assert(l); if (!iochannel_is_readable(l->io)) @@ -135,21 +135,26 @@ static int do_read(struct ioline *l) { e = memchr(l->rbuf+l->rbuf_index+l->rbuf_valid_length, '\n', r); l->rbuf_valid_length += r; - if (!e && l->rbuf_valid_length >= BUFFER_LIMIT) + if (!e &&l->rbuf_valid_length >= BUFFER_LIMIT) e = l->rbuf+BUFFER_LIMIT-1; + + if (e) { + char *p; - *e = 0; - p = l->rbuf+l->rbuf_index; - m = strlen(p); + *e = 0; + + p = l->rbuf+l->rbuf_index; + m = strlen(p); - if (l->callback) - l->callback(l, p, l->userdata); + if (l->callback) + l->callback(l, p, l->userdata); - l->rbuf_index += m+1; - l->rbuf_valid_length -= m+1; + l->rbuf_index += m+1; + l->rbuf_valid_length -= m+1; - if (l->rbuf_valid_length == 0) - l->rbuf_index = 0; + if (l->rbuf_valid_length == 0) + l->rbuf_index = 0; + } return 0; } @@ -184,7 +189,7 @@ static void io_callback(struct iochannel*io, void *userdata) { return; fail: + l->dead = 1; if (l->callback) l->callback(l, NULL, l->userdata); - l->dead = 1; } diff --git a/src/polyp.c b/src/polyp.c index c298d46d..c2d1d822 100644 --- a/src/polyp.c +++ b/src/polyp.c @@ -267,7 +267,7 @@ static int command_request(struct pdispatch *pd, uint32_t command, uint32_t tag, return -1; } - fprintf(stderr, "Requested %u bytes\n", bytes); + /*fprintf(stderr, "Requested %u bytes\n", bytes);*/ s->requested_bytes += bytes; @@ -426,7 +426,7 @@ void pa_stream_write(struct pa_stream *s, const void *data, size_t length) { pstream_send_memblock(s->context->pstream, s->channel, 0, &chunk); memblock_unref(chunk.memblock); - fprintf(stderr, "Sent %u bytes\n", length); + /*fprintf(stderr, "Sent %u bytes\n", length);*/ if (length < s->requested_bytes) s->requested_bytes -= length; diff --git a/src/protocol-native.c b/src/protocol-native.c index b8a461ae..27b547a6 100644 --- a/src/protocol-native.c +++ b/src/protocol-native.c @@ -157,7 +157,7 @@ static void request_bytes(struct playback_stream *s) { tagstruct_putu32(t, l); pstream_send_tagstruct(s->connection->pstream, t); - fprintf(stderr, "Requesting %u bytes\n", l); +/* fprintf(stderr, "Requesting %u bytes\n", l);*/ } /*** sinkinput callbacks ***/ @@ -327,7 +327,7 @@ static int memblock_callback(struct pstream *p, uint32_t channel, int32_t delta, assert(stream->sink_input); sink_notify(stream->sink_input->sink); - fprintf(stderr, "Recieved %u bytes.\n", chunk->length); + /*fprintf(stderr, "Recieved %u bytes.\n", chunk->length);*/ return 0; } -- cgit