summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@digia.com>2011-09-29 18:54:03 +0300
committerColin Guthrie <colin@mageia.org>2011-10-01 13:25:16 +0100
commit666261ece8cfa9b5458a1c1358b7ae4b9682b6a5 (patch)
tree2de67fe525e0e20363d8ef8a7e933d763717efb2
parent4d930f19f93d1823e6aa28c2b990d2ca3ff8a9ba (diff)
memblockq: Improve debuggability by storing a name and a sample spec.
These are not used for anything at this point, but this makes it easy to add ad-hoc debug prints that show the memblockq name and to convert between bytes and usecs.
-rw-r--r--src/modules/echo-cancel/module-echo-cancel.c8
-rw-r--r--src/modules/module-combine-sink.c3
-rw-r--r--src/modules/module-equalizer-sink.c4
-rw-r--r--src/modules/module-ladspa-sink.c2
-rw-r--r--src/modules/module-loopback.c3
-rw-r--r--src/modules/module-virtual-sink.c2
-rw-r--r--src/modules/module-virtual-source.c4
-rw-r--r--src/modules/rtp/module-rtp-recv.c3
-rw-r--r--src/modules/rtp/module-rtp-send.c3
-rw-r--r--src/pulse/stream.c3
-rw-r--r--src/pulsecore/memblockq.c15
-rw-r--r--src/pulsecore/memblockq.h11
-rw-r--r--src/pulsecore/play-memchunk.c2
-rw-r--r--src/pulsecore/protocol-esound.c6
-rw-r--r--src/pulsecore/protocol-http.c3
-rw-r--r--src/pulsecore/protocol-native.c12
-rw-r--r--src/pulsecore/protocol-simple.c6
-rw-r--r--src/pulsecore/sink-input.c24
-rw-r--r--src/pulsecore/sound-file-stream.c2
-rw-r--r--src/pulsecore/source-output.c6
-rw-r--r--src/tests/memblockq-test.c7
21 files changed, 86 insertions, 43 deletions
diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index 6c7828f46..7e0dcefca 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -1608,10 +1608,10 @@ int pa__init(pa_module*m) {
pa_sink_input_get_silence(u->sink_input, &silence);
- u->source_memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0,
- pa_frame_size(&source_ss), 1, 1, 0, &silence);
- u->sink_memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0,
- pa_frame_size(&sink_ss), 1, 1, 0, &silence);
+ u->source_memblockq = pa_memblockq_new("module-echo-cancel source_memblockq", 0, MEMBLOCKQ_MAXLENGTH, 0,
+ &source_ss, 1, 1, 0, &silence);
+ u->sink_memblockq = pa_memblockq_new("module-echo-cancel sink_memblockq", 0, MEMBLOCKQ_MAXLENGTH, 0,
+ &sink_ss, 1, 1, 0, &silence);
pa_memblock_unref(silence.memblock);
diff --git a/src/modules/module-combine-sink.c b/src/modules/module-combine-sink.c
index 8bdc5b7d8..dec227918 100644
--- a/src/modules/module-combine-sink.c
+++ b/src/modules/module-combine-sink.c
@@ -897,10 +897,11 @@ static struct output *output_new(struct userdata *u, pa_sink *sink) {
o->outq = pa_asyncmsgq_new(0);
o->sink = sink;
o->memblockq = pa_memblockq_new(
+ "module-combine-sink output memblockq",
0,
MEMBLOCKQ_MAXLENGTH,
MEMBLOCKQ_MAXLENGTH,
- pa_frame_size(&u->sink->sample_spec),
+ &u->sink->sample_spec,
1,
0,
0,
diff --git a/src/modules/module-equalizer-sink.c b/src/modules/module-equalizer-sink.c
index e0587fe1b..46bd0d7f2 100644
--- a/src/modules/module-equalizer-sink.c
+++ b/src/modules/module-equalizer-sink.c
@@ -1207,8 +1207,8 @@ int pa__init(pa_module*m) {
}
u->sink->userdata = u;
- u->input_q = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, fs, 1, 1, 0, &u->sink->silence);
- u->output_q = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, fs, 1, 1, 0, NULL);
+ u->input_q = pa_memblockq_new("module-equalizer-sink input_q", 0, MEMBLOCKQ_MAXLENGTH, 0, &ss, 1, 1, 0, &u->sink->silence);
+ u->output_q = pa_memblockq_new("module-equalizer-sink output_q", 0, MEMBLOCKQ_MAXLENGTH, 0, &ss, 1, 1, 0, NULL);
u->output_buffer = NULL;
u->output_buffer_length = 0;
u->output_buffer_max_length = 0;
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index 7d81e0d46..be05715d7 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -529,7 +529,7 @@ int pa__init(pa_module*m) {
u = pa_xnew0(struct userdata, 1);
u->module = m;
m->userdata = u;
- u->memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, pa_frame_size(&ss), 1, 1, 0, NULL);
+ u->memblockq = pa_memblockq_new("module-ladspa-sink memblockq", 0, MEMBLOCKQ_MAXLENGTH, 0, &ss, 1, 1, 0, NULL);
u->max_ladspaport_count = 1; /*to avoid division by zero etc. in pa__done when failing before this value has been set*/
u->channels = 0;
u->input = NULL;
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 627a16f16..529125802 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -806,10 +806,11 @@ int pa__init(pa_module *m) {
pa_sink_input_get_silence(u->sink_input, &silence);
u->memblockq = pa_memblockq_new(
+ "module-loopback memblockq",
0, /* idx */
MEMBLOCKQ_MAXLENGTH, /* maxlength */
MEMBLOCKQ_MAXLENGTH, /* tlength */
- pa_frame_size(&ss), /* base */
+ &ss, /* sample_spec */
0, /* prebuf */
0, /* minreq */
0, /* maxrewind */
diff --git a/src/modules/module-virtual-sink.c b/src/modules/module-virtual-sink.c
index dd3de862d..e7c476e26 100644
--- a/src/modules/module-virtual-sink.c
+++ b/src/modules/module-virtual-sink.c
@@ -614,7 +614,7 @@ int pa__init(pa_module*m) {
u->sink->input_to_master = u->sink_input;
pa_sink_input_get_silence(u->sink_input, &silence);
- u->memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, pa_frame_size(&ss), 1, 1, 0, &silence);
+ u->memblockq = pa_memblockq_new("module-virtual-sink memblockq", 0, MEMBLOCKQ_MAXLENGTH, 0, &ss, 1, 1, 0, &silence);
pa_memblock_unref(silence.memblock);
/* (9) INITIALIZE ANYTHING ELSE YOU NEED HERE */
diff --git a/src/modules/module-virtual-source.c b/src/modules/module-virtual-source.c
index 00a4b65cf..bf07580a8 100644
--- a/src/modules/module-virtual-source.c
+++ b/src/modules/module-virtual-source.c
@@ -548,7 +548,7 @@ int pa__init(pa_module*m) {
}
u->module = m;
m->userdata = u;
- u->memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, pa_frame_size(&ss), 1, 1, 0, NULL);
+ u->memblockq = pa_memblockq_new("module-virtual-source memblockq", 0, MEMBLOCKQ_MAXLENGTH, 0, &ss, 1, 1, 0, NULL);
if (!u->memblockq) {
pa_log("Failed to create source memblockq.");
goto fail;
@@ -659,7 +659,7 @@ int pa__init(pa_module*m) {
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Uplink Sink %s on %s", sink_data.name, z ? z : master->name);
}
- u->sink_memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, pa_frame_size(&ss), 1, 1, 0, NULL);
+ u->sink_memblockq = pa_memblockq_new("module-virtual-source sink_memblockq", 0, MEMBLOCKQ_MAXLENGTH, 0, &ss, 1, 1, 0, NULL);
if (!u->sink_memblockq) {
pa_sink_new_data_done(&sink_data);
pa_log("Failed to create sink memblockq.");
diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index 7025c15a6..9d8680553 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -556,10 +556,11 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
s->intended_latency = s->sink_latency*2;
s->memblockq = pa_memblockq_new(
+ "module-rtp-recv memblockq",
0,
MEMBLOCKQ_MAXLENGTH,
MEMBLOCKQ_MAXLENGTH,
- pa_frame_size(&s->sink_input->sample_spec),
+ &s->sink_input->sample_spec,
pa_usec_to_bytes(s->intended_latency - s->sink_latency, &s->sink_input->sample_spec),
0,
0,
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 7131629cd..6502664ab 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -348,10 +348,11 @@ int pa__init(pa_module*m) {
u->source_output = o;
u->memblockq = pa_memblockq_new(
+ "module-rtp-send memblockq",
0,
MEMBLOCKQ_MAXLENGTH,
MEMBLOCKQ_MAXLENGTH,
- pa_frame_size(&ss),
+ &ss,
1,
0,
0,
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index ec88bf13b..3bf2d964b 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -1140,10 +1140,11 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag,
pa_assert(!s->record_memblockq);
s->record_memblockq = pa_memblockq_new(
+ "client side record memblockq",
0,
s->buffer_attr.maxlength,
0,
- pa_frame_size(&s->sample_spec),
+ &s->sample_spec,
1,
0,
0,
diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c
index 3e1f7bcf4..2bee0a2fa 100644
--- a/src/pulsecore/memblockq.c
+++ b/src/pulsecore/memblockq.c
@@ -54,13 +54,16 @@ struct pa_memblockq {
pa_memchunk silence;
pa_mcalign *mcalign;
int64_t missing, requested;
+ char *name;
+ pa_sample_spec sample_spec;
};
pa_memblockq* pa_memblockq_new(
+ const char *name,
int64_t idx,
size_t maxlength,
size_t tlength,
- size_t base,
+ const pa_sample_spec *sample_spec,
size_t prebuf,
size_t minreq,
size_t maxrewind,
@@ -68,18 +71,21 @@ pa_memblockq* pa_memblockq_new(
pa_memblockq* bq;
- pa_assert(base > 0);
+ pa_assert(sample_spec);
+ pa_assert(name);
bq = pa_xnew(pa_memblockq, 1);
+ bq->name = pa_xstrdup(name);
bq->blocks = bq->blocks_tail = NULL;
bq->current_read = bq->current_write = NULL;
bq->n_blocks = 0;
- bq->base = base;
+ bq->sample_spec = *sample_spec;
+ bq->base = pa_frame_size(sample_spec);
bq->read_index = bq->write_index = idx;
pa_log_debug("memblockq requested: maxlength=%lu, tlength=%lu, base=%lu, prebuf=%lu, minreq=%lu maxrewind=%lu",
- (unsigned long) maxlength, (unsigned long) tlength, (unsigned long) base, (unsigned long) prebuf, (unsigned long) minreq, (unsigned long) maxrewind);
+ (unsigned long) maxlength, (unsigned long) tlength, (unsigned long) bq->base, (unsigned long) prebuf, (unsigned long) minreq, (unsigned long) maxrewind);
bq->missing = bq->requested = 0;
bq->maxlength = bq->tlength = bq->prebuf = bq->minreq = bq->maxrewind = 0;
@@ -116,6 +122,7 @@ void pa_memblockq_free(pa_memblockq* bq) {
if (bq->mcalign)
pa_mcalign_free(bq->mcalign);
+ pa_xfree(bq->name);
pa_xfree(bq);
}
diff --git a/src/pulsecore/memblockq.h b/src/pulsecore/memblockq.h
index 8d1f1370a..08c0bf04f 100644
--- a/src/pulsecore/memblockq.h
+++ b/src/pulsecore/memblockq.h
@@ -40,6 +40,8 @@ typedef struct pa_memblockq pa_memblockq;
/* Parameters:
+ - name: name for debugging purposes
+
- idx: start value for both read and write index
- maxlength: maximum length of queue. If more data is pushed into
@@ -47,9 +49,9 @@ typedef struct pa_memblockq pa_memblockq;
- tlength: the target length of the queue. Pass 0 for the default.
- - base: a base value for all metrics. Only multiples of this value
- are popped from the queue or should be pushed into
- it. Must not be 0.
+ - ss: Sample spec describing the queue contents. Only multiples
+ of the frame size as implied by the sample spec are
+ popped from the queue or should be pushed into it.
- prebuf: If the queue runs empty wait until this many bytes are in
queue again before passing the first byte out. If set
@@ -65,10 +67,11 @@ typedef struct pa_memblockq pa_memblockq;
- silence: return this memchunk when reading uninitialized data
*/
pa_memblockq* pa_memblockq_new(
+ const char *name,
int64_t idx,
size_t maxlength,
size_t tlength,
- size_t base,
+ const pa_sample_spec *sample_spec,
size_t prebuf,
size_t minreq,
size_t maxrewind,
diff --git a/src/pulsecore/play-memchunk.c b/src/pulsecore/play-memchunk.c
index ee25958fa..26a2bccd1 100644
--- a/src/pulsecore/play-memchunk.c
+++ b/src/pulsecore/play-memchunk.c
@@ -50,7 +50,7 @@ int pa_play_memchunk(
pa_assert(chunk);
pa_silence_memchunk_get(&sink->core->silence_cache, sink->core->mempool, &silence, ss, 0);
- q = pa_memblockq_new(0, chunk->length, 0, pa_frame_size(ss), 1, 1, 0, &silence);
+ q = pa_memblockq_new("pa_play_memchunk() q", 0, chunk->length, 0, ss, 1, 1, 0, &silence);
pa_memblock_unref(silence.memblock);
pa_assert_se(pa_memblockq_push(q, chunk) >= 0);
diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c
index 5527c306c..4e1c56cf9 100644
--- a/src/pulsecore/protocol-esound.c
+++ b/src/pulsecore/protocol-esound.c
@@ -436,10 +436,11 @@ static int esd_proto_stream_play(connection *c, esd_proto_t request, const void
l = (size_t) ((double) pa_bytes_per_second(&ss)*PLAYBACK_BUFFER_SECONDS);
pa_sink_input_get_silence(c->sink_input, &silence);
c->input_memblockq = pa_memblockq_new(
+ "esound protocol connection input_memblockq",
0,
l,
l,
- pa_frame_size(&ss),
+ &ss,
(size_t) -1,
l/PLAYBACK_BUFFER_FRAGMENTS,
0,
@@ -534,10 +535,11 @@ static int esd_proto_stream_record(connection *c, esd_proto_t request, const voi
l = (size_t) (pa_bytes_per_second(&ss)*RECORD_BUFFER_SECONDS);
c->output_memblockq = pa_memblockq_new(
+ "esound protocol connection output_memblockq",
0,
l,
l,
- pa_frame_size(&ss),
+ &ss,
1,
0,
0,
diff --git a/src/pulsecore/protocol-http.c b/src/pulsecore/protocol-http.c
index d085e618d..d74563458 100644
--- a/src/pulsecore/protocol-http.c
+++ b/src/pulsecore/protocol-http.c
@@ -584,10 +584,11 @@ static void handle_listen_prefix(struct connection *c, const char *source_name)
l = (size_t) (pa_bytes_per_second(&ss)*RECORD_BUFFER_SECONDS);
c->output_memblockq = pa_memblockq_new(
+ "http protocol connection output_memblockq",
0,
l,
0,
- pa_frame_size(&ss),
+ &ss,
1,
0,
0,
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index e8714784a..0ee4ead21 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -646,6 +646,7 @@ static record_stream* record_stream_new(
record_stream *s;
pa_source_output *source_output = NULL;
pa_source_output_new_data data;
+ char *memblockq_name;
pa_assert(c);
pa_assert(ss);
@@ -708,15 +709,18 @@ static record_stream* record_stream_new(
fix_record_buffer_attr_pre(s);
+ memblockq_name = pa_sprintf_malloc("native protocol record stream memblockq [%u]", s->source_output->index);
s->memblockq = pa_memblockq_new(
+ memblockq_name,
0,
s->buffer_attr.maxlength,
0,
- pa_frame_size(&source_output->sample_spec),
+ &source_output->sample_spec,
1,
0,
0,
NULL);
+ pa_xfree(memblockq_name);
pa_memblockq_get_attr(s->memblockq, &s->buffer_attr);
fix_record_buffer_attr_post(s);
@@ -1068,6 +1072,7 @@ static playback_stream* playback_stream_new(
uint32_t idx;
int64_t start_index;
pa_sink_input_new_data data;
+ char *memblockq_name;
pa_assert(c);
pa_assert(ss);
@@ -1163,15 +1168,18 @@ static playback_stream* playback_stream_new(
fix_playback_buffer_attr(s);
pa_sink_input_get_silence(sink_input, &silence);
+ memblockq_name = pa_sprintf_malloc("native protocol playback stream memblockq [%u]", s->sink_input->index);
s->memblockq = pa_memblockq_new(
+ memblockq_name,
start_index,
s->buffer_attr.maxlength,
s->buffer_attr.tlength,
- pa_frame_size(&sink_input->sample_spec),
+ &sink_input->sample_spec,
s->buffer_attr.prebuf,
s->buffer_attr.minreq,
0,
&silence);
+ pa_xfree(memblockq_name);
pa_memblock_unref(silence.memblock);
pa_memblockq_get_attr(s->memblockq, &s->buffer_attr);
diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c
index 978339de3..8d8f5b8b8 100644
--- a/src/pulsecore/protocol-simple.c
+++ b/src/pulsecore/protocol-simple.c
@@ -560,10 +560,11 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp
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(
+ "simple protocol connection input_memblockq",
0,
l,
l,
- pa_frame_size(&o->sample_spec),
+ &o->sample_spec,
(size_t) -1,
l/PLAYBACK_BUFFER_FRAGMENTS,
0,
@@ -611,10 +612,11 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp
l = (size_t) (pa_bytes_per_second(&o->sample_spec)*RECORD_BUFFER_SECONDS);
c->output_memblockq = pa_memblockq_new(
+ "simple protocol connection output_memblockq",
0,
l,
0,
- pa_frame_size(&o->sample_spec),
+ &o->sample_spec,
1,
0,
0,
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 15944f436..5146a9d9e 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -242,6 +242,7 @@ int pa_sink_input_new(
pa_channel_map original_cm;
int r;
char *pt;
+ char *memblockq_name;
pa_sample_spec ss;
pa_channel_map map;
@@ -481,21 +482,24 @@ int pa_sink_input_new(
i->thread_info.playing_for = 0;
i->thread_info.direct_outputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+ pa_assert_se(pa_idxset_put(core->sink_inputs, i, &i->index) == 0);
+ pa_assert_se(pa_idxset_put(i->sink->inputs, pa_sink_input_ref(i), NULL) == 0);
+
+ if (i->client)
+ pa_assert_se(pa_idxset_put(i->client->sink_inputs, i, NULL) >= 0);
+
+ memblockq_name = pa_sprintf_malloc("sink input render_memblockq [%u]", i->index);
i->thread_info.render_memblockq = pa_memblockq_new(
+ memblockq_name,
0,
MEMBLOCKQ_MAXLENGTH,
0,
- pa_frame_size(&i->sink->sample_spec),
+ &i->sink->sample_spec,
0,
1,
0,
&i->sink->silence);
-
- pa_assert_se(pa_idxset_put(core->sink_inputs, i, &i->index) == 0);
- pa_assert_se(pa_idxset_put(i->sink->inputs, pa_sink_input_ref(i), NULL) == 0);
-
- if (i->client)
- pa_assert_se(pa_idxset_put(i->client->sink_inputs, i, NULL) >= 0);
+ pa_xfree(memblockq_name);
pt = pa_proplist_to_string_sep(i->proplist, "\n ");
pa_log_info("Created input %u \"%s\" on %s with sample spec %s and channel map %s\n %s",
@@ -1643,6 +1647,7 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) {
/* Replace resampler and render queue */
if (new_resampler != i->thread_info.resampler) {
+ char *memblockq_name;
if (i->thread_info.resampler)
pa_resampler_free(i->thread_info.resampler);
@@ -1650,15 +1655,18 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) {
pa_memblockq_free(i->thread_info.render_memblockq);
+ memblockq_name = pa_sprintf_malloc("sink input render_memblockq [%u]", i->index);
i->thread_info.render_memblockq = pa_memblockq_new(
+ memblockq_name,
0,
MEMBLOCKQ_MAXLENGTH,
0,
- pa_frame_size(&i->sink->sample_spec),
+ &i->sink->sample_spec,
0,
1,
0,
&i->sink->silence);
+ pa_xfree(memblockq_name);
i->actual_resample_method = new_resampler ? pa_resampler_get_method(new_resampler) : PA_RESAMPLER_INVALID;
}
diff --git a/src/pulsecore/sound-file-stream.c b/src/pulsecore/sound-file-stream.c
index 96b5fb823..24d331413 100644
--- a/src/pulsecore/sound-file-stream.c
+++ b/src/pulsecore/sound-file-stream.c
@@ -320,7 +320,7 @@ int pa_play_file(
u->sink_input->userdata = u;
pa_sink_input_get_silence(u->sink_input, &silence);
- u->memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, pa_frame_size(&ss), 1, 1, 0, &silence);
+ u->memblockq = pa_memblockq_new("sound-file-stream memblockq", 0, MEMBLOCKQ_MAXLENGTH, 0, &ss, 1, 1, 0, &silence);
pa_memblock_unref(silence.memblock);
pa_sink_input_put(u->sink_input);
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 1e08a03f5..ea0e7601a 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -443,10 +443,11 @@ int pa_source_output_new(
o->thread_info.direct_on_input = o->direct_on_input;
o->thread_info.delay_memblockq = pa_memblockq_new(
+ "source output delay_memblockq",
0,
MEMBLOCKQ_MAXLENGTH,
0,
- pa_frame_size(&o->source->sample_spec),
+ &o->source->sample_spec,
0,
1,
0,
@@ -1433,10 +1434,11 @@ int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, pa_bool_t
pa_memblockq_free(o->thread_info.delay_memblockq);
o->thread_info.delay_memblockq = pa_memblockq_new(
+ "source output delay_memblockq",
0,
MEMBLOCKQ_MAXLENGTH,
0,
- pa_frame_size(&o->source->sample_spec),
+ &o->source->sample_spec,
0,
1,
0,
diff --git a/src/tests/memblockq-test.c b/src/tests/memblockq-test.c
index b6c60039b..085d70e37 100644
--- a/src/tests/memblockq-test.c
+++ b/src/tests/memblockq-test.c
@@ -76,6 +76,11 @@ int main(int argc, char *argv[]) {
pa_memblockq *bq;
pa_memchunk chunk1, chunk2, chunk3, chunk4;
pa_memchunk silence;
+ pa_sample_spec ss = {
+ .format = PA_SAMPLE_S16LE,
+ .rate = 48000,
+ .channels = 1
+ };
pa_log_set_level(PA_LOG_DEBUG);
@@ -86,7 +91,7 @@ int main(int argc, char *argv[]) {
silence.index = 0;
silence.length = pa_memblock_get_length(silence.memblock);
- bq = pa_memblockq_new(0, 200, 10, 2, 4, 4, 40, &silence);
+ bq = pa_memblockq_new("test memblockq", 0, 200, 10, &ss, 4, 4, 40, &silence);
assert(bq);
chunk1.memblock = pa_memblock_new_fixed(p, (char*) "11", 2, 1);