summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/protocol-simple.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-08 21:51:30 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-08 21:51:30 +0100
commit3eed219a50c943251b41814e779cc37daf47e8f4 (patch)
treee96dbff80bad3d28cb27c233f2115c9b0457a4b6 /src/pulsecore/protocol-simple.c
parent8d356659e69556fa25d0579a66084f820683e2b8 (diff)
core: make sure we always return a valid memblock in sink_input_pop() callbacks
https://bugzilla.redhat.com/show_bug.cgi?id=553607
Diffstat (limited to 'src/pulsecore/protocol-simple.c')
-rw-r--r--src/pulsecore/protocol-simple.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c
index a9f73896..fb2e5648 100644
--- a/src/pulsecore/protocol-simple.c
+++ b/src/pulsecore/protocol-simple.c
@@ -525,6 +525,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp
if (o->playback) {
pa_sink_input_new_data data;
+ pa_memchunk silence;
size_t l;
pa_sink *sink;
@@ -559,6 +560,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp
pa_sink_input_set_requested_latency(c->sink_input, DEFAULT_SINK_LATENCY);
l = (size_t) ((double) pa_bytes_per_second(&o->sample_spec)*PLAYBACK_BUFFER_SECONDS);
+ pa_sink_input_get_silence(c->sink_input, &silence);
c->input_memblockq = pa_memblockq_new(
0,
l,
@@ -567,7 +569,9 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp
(size_t) -1,
l/PLAYBACK_BUFFER_FRAGMENTS,
0,
- NULL);
+ &silence);
+ pa_memblock_unref(silence.memblock);
+
pa_iochannel_socket_set_rcvbuf(io, l);
pa_atomic_store(&c->playback.missing, (int) pa_memblockq_missing(c->input_memblockq));