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);
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,
}
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;
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;
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 */
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 */
}
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;
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.");
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,
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,
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,
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,
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;
if (bq->mcalign)
pa_mcalign_free(bq->mcalign);
+ pa_xfree(bq->name);
pa_xfree(bq);
}
/* 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
- 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
- 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,
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);
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,
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,
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,
record_stream *s;
pa_source_output *source_output = NULL;
pa_source_output_new_data data;
+ char *memblockq_name;
pa_assert(c);
pa_assert(ss);
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);
uint32_t idx;
int64_t start_index;
pa_sink_input_new_data data;
+ char *memblockq_name;
pa_assert(c);
pa_assert(ss);
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);
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,
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,
pa_channel_map original_cm;
int r;
char *pt;
+ char *memblockq_name;
pa_sample_spec ss;
pa_channel_map map;
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",
/* 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);
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;
}
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);
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,
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,
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);
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);