mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
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.
This commit is contained in:
parent
4d930f19f9
commit
666261ece8
21 changed files with 89 additions and 46 deletions
|
|
@ -1608,10 +1608,10 @@ int pa__init(pa_module*m) {
|
||||||
|
|
||||||
pa_sink_input_get_silence(u->sink_input, &silence);
|
pa_sink_input_get_silence(u->sink_input, &silence);
|
||||||
|
|
||||||
u->source_memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0,
|
u->source_memblockq = pa_memblockq_new("module-echo-cancel source_memblockq", 0, MEMBLOCKQ_MAXLENGTH, 0,
|
||||||
pa_frame_size(&source_ss), 1, 1, 0, &silence);
|
&source_ss, 1, 1, 0, &silence);
|
||||||
u->sink_memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0,
|
u->sink_memblockq = pa_memblockq_new("module-echo-cancel sink_memblockq", 0, MEMBLOCKQ_MAXLENGTH, 0,
|
||||||
pa_frame_size(&sink_ss), 1, 1, 0, &silence);
|
&sink_ss, 1, 1, 0, &silence);
|
||||||
|
|
||||||
pa_memblock_unref(silence.memblock);
|
pa_memblock_unref(silence.memblock);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -897,10 +897,11 @@ static struct output *output_new(struct userdata *u, pa_sink *sink) {
|
||||||
o->outq = pa_asyncmsgq_new(0);
|
o->outq = pa_asyncmsgq_new(0);
|
||||||
o->sink = sink;
|
o->sink = sink;
|
||||||
o->memblockq = pa_memblockq_new(
|
o->memblockq = pa_memblockq_new(
|
||||||
|
"module-combine-sink output memblockq",
|
||||||
0,
|
0,
|
||||||
MEMBLOCKQ_MAXLENGTH,
|
MEMBLOCKQ_MAXLENGTH,
|
||||||
MEMBLOCKQ_MAXLENGTH,
|
MEMBLOCKQ_MAXLENGTH,
|
||||||
pa_frame_size(&u->sink->sample_spec),
|
&u->sink->sample_spec,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -1207,8 +1207,8 @@ int pa__init(pa_module*m) {
|
||||||
}
|
}
|
||||||
u->sink->userdata = u;
|
u->sink->userdata = u;
|
||||||
|
|
||||||
u->input_q = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, fs, 1, 1, 0, &u->sink->silence);
|
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(0, MEMBLOCKQ_MAXLENGTH, 0, fs, 1, 1, 0, NULL);
|
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 = NULL;
|
||||||
u->output_buffer_length = 0;
|
u->output_buffer_length = 0;
|
||||||
u->output_buffer_max_length = 0;
|
u->output_buffer_max_length = 0;
|
||||||
|
|
|
||||||
|
|
@ -529,7 +529,7 @@ int pa__init(pa_module*m) {
|
||||||
u = pa_xnew0(struct userdata, 1);
|
u = pa_xnew0(struct userdata, 1);
|
||||||
u->module = m;
|
u->module = m;
|
||||||
m->userdata = u;
|
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->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->channels = 0;
|
||||||
u->input = NULL;
|
u->input = NULL;
|
||||||
|
|
|
||||||
|
|
@ -806,10 +806,11 @@ int pa__init(pa_module *m) {
|
||||||
|
|
||||||
pa_sink_input_get_silence(u->sink_input, &silence);
|
pa_sink_input_get_silence(u->sink_input, &silence);
|
||||||
u->memblockq = pa_memblockq_new(
|
u->memblockq = pa_memblockq_new(
|
||||||
|
"module-loopback memblockq",
|
||||||
0, /* idx */
|
0, /* idx */
|
||||||
MEMBLOCKQ_MAXLENGTH, /* maxlength */
|
MEMBLOCKQ_MAXLENGTH, /* maxlength */
|
||||||
MEMBLOCKQ_MAXLENGTH, /* tlength */
|
MEMBLOCKQ_MAXLENGTH, /* tlength */
|
||||||
pa_frame_size(&ss), /* base */
|
&ss, /* sample_spec */
|
||||||
0, /* prebuf */
|
0, /* prebuf */
|
||||||
0, /* minreq */
|
0, /* minreq */
|
||||||
0, /* maxrewind */
|
0, /* maxrewind */
|
||||||
|
|
|
||||||
|
|
@ -614,7 +614,7 @@ int pa__init(pa_module*m) {
|
||||||
u->sink->input_to_master = u->sink_input;
|
u->sink->input_to_master = u->sink_input;
|
||||||
|
|
||||||
pa_sink_input_get_silence(u->sink_input, &silence);
|
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);
|
pa_memblock_unref(silence.memblock);
|
||||||
|
|
||||||
/* (9) INITIALIZE ANYTHING ELSE YOU NEED HERE */
|
/* (9) INITIALIZE ANYTHING ELSE YOU NEED HERE */
|
||||||
|
|
|
||||||
|
|
@ -548,7 +548,7 @@ int pa__init(pa_module*m) {
|
||||||
}
|
}
|
||||||
u->module = m;
|
u->module = m;
|
||||||
m->userdata = u;
|
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) {
|
if (!u->memblockq) {
|
||||||
pa_log("Failed to create source memblockq.");
|
pa_log("Failed to create source memblockq.");
|
||||||
goto fail;
|
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);
|
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) {
|
if (!u->sink_memblockq) {
|
||||||
pa_sink_new_data_done(&sink_data);
|
pa_sink_new_data_done(&sink_data);
|
||||||
pa_log("Failed to create sink memblockq.");
|
pa_log("Failed to create sink memblockq.");
|
||||||
|
|
|
||||||
|
|
@ -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->intended_latency = s->sink_latency*2;
|
||||||
|
|
||||||
s->memblockq = pa_memblockq_new(
|
s->memblockq = pa_memblockq_new(
|
||||||
|
"module-rtp-recv memblockq",
|
||||||
0,
|
0,
|
||||||
MEMBLOCKQ_MAXLENGTH,
|
MEMBLOCKQ_MAXLENGTH,
|
||||||
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),
|
pa_usec_to_bytes(s->intended_latency - s->sink_latency, &s->sink_input->sample_spec),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -348,10 +348,11 @@ int pa__init(pa_module*m) {
|
||||||
u->source_output = o;
|
u->source_output = o;
|
||||||
|
|
||||||
u->memblockq = pa_memblockq_new(
|
u->memblockq = pa_memblockq_new(
|
||||||
|
"module-rtp-send memblockq",
|
||||||
0,
|
0,
|
||||||
MEMBLOCKQ_MAXLENGTH,
|
MEMBLOCKQ_MAXLENGTH,
|
||||||
MEMBLOCKQ_MAXLENGTH,
|
MEMBLOCKQ_MAXLENGTH,
|
||||||
pa_frame_size(&ss),
|
&ss,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -1140,10 +1140,11 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag,
|
||||||
pa_assert(!s->record_memblockq);
|
pa_assert(!s->record_memblockq);
|
||||||
|
|
||||||
s->record_memblockq = pa_memblockq_new(
|
s->record_memblockq = pa_memblockq_new(
|
||||||
|
"client side record memblockq",
|
||||||
0,
|
0,
|
||||||
s->buffer_attr.maxlength,
|
s->buffer_attr.maxlength,
|
||||||
0,
|
0,
|
||||||
pa_frame_size(&s->sample_spec),
|
&s->sample_spec,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -54,13 +54,16 @@ struct pa_memblockq {
|
||||||
pa_memchunk silence;
|
pa_memchunk silence;
|
||||||
pa_mcalign *mcalign;
|
pa_mcalign *mcalign;
|
||||||
int64_t missing, requested;
|
int64_t missing, requested;
|
||||||
|
char *name;
|
||||||
|
pa_sample_spec sample_spec;
|
||||||
};
|
};
|
||||||
|
|
||||||
pa_memblockq* pa_memblockq_new(
|
pa_memblockq* pa_memblockq_new(
|
||||||
|
const char *name,
|
||||||
int64_t idx,
|
int64_t idx,
|
||||||
size_t maxlength,
|
size_t maxlength,
|
||||||
size_t tlength,
|
size_t tlength,
|
||||||
size_t base,
|
const pa_sample_spec *sample_spec,
|
||||||
size_t prebuf,
|
size_t prebuf,
|
||||||
size_t minreq,
|
size_t minreq,
|
||||||
size_t maxrewind,
|
size_t maxrewind,
|
||||||
|
|
@ -68,18 +71,21 @@ pa_memblockq* pa_memblockq_new(
|
||||||
|
|
||||||
pa_memblockq* bq;
|
pa_memblockq* bq;
|
||||||
|
|
||||||
pa_assert(base > 0);
|
pa_assert(sample_spec);
|
||||||
|
pa_assert(name);
|
||||||
|
|
||||||
bq = pa_xnew(pa_memblockq, 1);
|
bq = pa_xnew(pa_memblockq, 1);
|
||||||
|
bq->name = pa_xstrdup(name);
|
||||||
bq->blocks = bq->blocks_tail = NULL;
|
bq->blocks = bq->blocks_tail = NULL;
|
||||||
bq->current_read = bq->current_write = NULL;
|
bq->current_read = bq->current_write = NULL;
|
||||||
bq->n_blocks = 0;
|
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;
|
bq->read_index = bq->write_index = idx;
|
||||||
|
|
||||||
pa_log_debug("memblockq requested: maxlength=%lu, tlength=%lu, base=%lu, prebuf=%lu, minreq=%lu maxrewind=%lu",
|
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->missing = bq->requested = 0;
|
||||||
bq->maxlength = bq->tlength = bq->prebuf = bq->minreq = bq->maxrewind = 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)
|
if (bq->mcalign)
|
||||||
pa_mcalign_free(bq->mcalign);
|
pa_mcalign_free(bq->mcalign);
|
||||||
|
|
||||||
|
pa_xfree(bq->name);
|
||||||
pa_xfree(bq);
|
pa_xfree(bq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ typedef struct pa_memblockq pa_memblockq;
|
||||||
|
|
||||||
/* Parameters:
|
/* Parameters:
|
||||||
|
|
||||||
|
- name: name for debugging purposes
|
||||||
|
|
||||||
- idx: start value for both read and write index
|
- idx: start value for both read and write index
|
||||||
|
|
||||||
- maxlength: maximum length of queue. If more data is pushed into
|
- 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.
|
- tlength: the target length of the queue. Pass 0 for the default.
|
||||||
|
|
||||||
- base: a base value for all metrics. Only multiples of this value
|
- ss: Sample spec describing the queue contents. Only multiples
|
||||||
are popped from the queue or should be pushed into
|
of the frame size as implied by the sample spec are
|
||||||
it. Must not be 0.
|
popped from the queue or should be pushed into it.
|
||||||
|
|
||||||
- prebuf: If the queue runs empty wait until this many bytes are in
|
- prebuf: If the queue runs empty wait until this many bytes are in
|
||||||
queue again before passing the first byte out. If set
|
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
|
- silence: return this memchunk when reading uninitialized data
|
||||||
*/
|
*/
|
||||||
pa_memblockq* pa_memblockq_new(
|
pa_memblockq* pa_memblockq_new(
|
||||||
|
const char *name,
|
||||||
int64_t idx,
|
int64_t idx,
|
||||||
size_t maxlength,
|
size_t maxlength,
|
||||||
size_t tlength,
|
size_t tlength,
|
||||||
size_t base,
|
const pa_sample_spec *sample_spec,
|
||||||
size_t prebuf,
|
size_t prebuf,
|
||||||
size_t minreq,
|
size_t minreq,
|
||||||
size_t maxrewind,
|
size_t maxrewind,
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ int pa_play_memchunk(
|
||||||
pa_assert(chunk);
|
pa_assert(chunk);
|
||||||
|
|
||||||
pa_silence_memchunk_get(&sink->core->silence_cache, sink->core->mempool, &silence, ss, 0);
|
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_memblock_unref(silence.memblock);
|
||||||
|
|
||||||
pa_assert_se(pa_memblockq_push(q, chunk) >= 0);
|
pa_assert_se(pa_memblockq_push(q, chunk) >= 0);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
l = (size_t) ((double) pa_bytes_per_second(&ss)*PLAYBACK_BUFFER_SECONDS);
|
||||||
pa_sink_input_get_silence(c->sink_input, &silence);
|
pa_sink_input_get_silence(c->sink_input, &silence);
|
||||||
c->input_memblockq = pa_memblockq_new(
|
c->input_memblockq = pa_memblockq_new(
|
||||||
|
"esound protocol connection input_memblockq",
|
||||||
0,
|
0,
|
||||||
l,
|
l,
|
||||||
l,
|
l,
|
||||||
pa_frame_size(&ss),
|
&ss,
|
||||||
(size_t) -1,
|
(size_t) -1,
|
||||||
l/PLAYBACK_BUFFER_FRAGMENTS,
|
l/PLAYBACK_BUFFER_FRAGMENTS,
|
||||||
0,
|
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);
|
l = (size_t) (pa_bytes_per_second(&ss)*RECORD_BUFFER_SECONDS);
|
||||||
c->output_memblockq = pa_memblockq_new(
|
c->output_memblockq = pa_memblockq_new(
|
||||||
|
"esound protocol connection output_memblockq",
|
||||||
0,
|
0,
|
||||||
l,
|
l,
|
||||||
l,
|
l,
|
||||||
pa_frame_size(&ss),
|
&ss,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -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);
|
l = (size_t) (pa_bytes_per_second(&ss)*RECORD_BUFFER_SECONDS);
|
||||||
c->output_memblockq = pa_memblockq_new(
|
c->output_memblockq = pa_memblockq_new(
|
||||||
|
"http protocol connection output_memblockq",
|
||||||
0,
|
0,
|
||||||
l,
|
l,
|
||||||
0,
|
0,
|
||||||
pa_frame_size(&ss),
|
&ss,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -646,6 +646,7 @@ static record_stream* record_stream_new(
|
||||||
record_stream *s;
|
record_stream *s;
|
||||||
pa_source_output *source_output = NULL;
|
pa_source_output *source_output = NULL;
|
||||||
pa_source_output_new_data data;
|
pa_source_output_new_data data;
|
||||||
|
char *memblockq_name;
|
||||||
|
|
||||||
pa_assert(c);
|
pa_assert(c);
|
||||||
pa_assert(ss);
|
pa_assert(ss);
|
||||||
|
|
@ -708,15 +709,18 @@ static record_stream* record_stream_new(
|
||||||
|
|
||||||
fix_record_buffer_attr_pre(s);
|
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(
|
s->memblockq = pa_memblockq_new(
|
||||||
|
memblockq_name,
|
||||||
0,
|
0,
|
||||||
s->buffer_attr.maxlength,
|
s->buffer_attr.maxlength,
|
||||||
0,
|
0,
|
||||||
pa_frame_size(&source_output->sample_spec),
|
&source_output->sample_spec,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
NULL);
|
NULL);
|
||||||
|
pa_xfree(memblockq_name);
|
||||||
|
|
||||||
pa_memblockq_get_attr(s->memblockq, &s->buffer_attr);
|
pa_memblockq_get_attr(s->memblockq, &s->buffer_attr);
|
||||||
fix_record_buffer_attr_post(s);
|
fix_record_buffer_attr_post(s);
|
||||||
|
|
@ -1068,6 +1072,7 @@ static playback_stream* playback_stream_new(
|
||||||
uint32_t idx;
|
uint32_t idx;
|
||||||
int64_t start_index;
|
int64_t start_index;
|
||||||
pa_sink_input_new_data data;
|
pa_sink_input_new_data data;
|
||||||
|
char *memblockq_name;
|
||||||
|
|
||||||
pa_assert(c);
|
pa_assert(c);
|
||||||
pa_assert(ss);
|
pa_assert(ss);
|
||||||
|
|
@ -1163,15 +1168,18 @@ static playback_stream* playback_stream_new(
|
||||||
fix_playback_buffer_attr(s);
|
fix_playback_buffer_attr(s);
|
||||||
|
|
||||||
pa_sink_input_get_silence(sink_input, &silence);
|
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(
|
s->memblockq = pa_memblockq_new(
|
||||||
|
memblockq_name,
|
||||||
start_index,
|
start_index,
|
||||||
s->buffer_attr.maxlength,
|
s->buffer_attr.maxlength,
|
||||||
s->buffer_attr.tlength,
|
s->buffer_attr.tlength,
|
||||||
pa_frame_size(&sink_input->sample_spec),
|
&sink_input->sample_spec,
|
||||||
s->buffer_attr.prebuf,
|
s->buffer_attr.prebuf,
|
||||||
s->buffer_attr.minreq,
|
s->buffer_attr.minreq,
|
||||||
0,
|
0,
|
||||||
&silence);
|
&silence);
|
||||||
|
pa_xfree(memblockq_name);
|
||||||
pa_memblock_unref(silence.memblock);
|
pa_memblock_unref(silence.memblock);
|
||||||
|
|
||||||
pa_memblockq_get_attr(s->memblockq, &s->buffer_attr);
|
pa_memblockq_get_attr(s->memblockq, &s->buffer_attr);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
l = (size_t) ((double) pa_bytes_per_second(&o->sample_spec)*PLAYBACK_BUFFER_SECONDS);
|
||||||
pa_sink_input_get_silence(c->sink_input, &silence);
|
pa_sink_input_get_silence(c->sink_input, &silence);
|
||||||
c->input_memblockq = pa_memblockq_new(
|
c->input_memblockq = pa_memblockq_new(
|
||||||
|
"simple protocol connection input_memblockq",
|
||||||
0,
|
0,
|
||||||
l,
|
l,
|
||||||
l,
|
l,
|
||||||
pa_frame_size(&o->sample_spec),
|
&o->sample_spec,
|
||||||
(size_t) -1,
|
(size_t) -1,
|
||||||
l/PLAYBACK_BUFFER_FRAGMENTS,
|
l/PLAYBACK_BUFFER_FRAGMENTS,
|
||||||
0,
|
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);
|
l = (size_t) (pa_bytes_per_second(&o->sample_spec)*RECORD_BUFFER_SECONDS);
|
||||||
c->output_memblockq = pa_memblockq_new(
|
c->output_memblockq = pa_memblockq_new(
|
||||||
|
"simple protocol connection output_memblockq",
|
||||||
0,
|
0,
|
||||||
l,
|
l,
|
||||||
0,
|
0,
|
||||||
pa_frame_size(&o->sample_spec),
|
&o->sample_spec,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,7 @@ int pa_sink_input_new(
|
||||||
pa_channel_map original_cm;
|
pa_channel_map original_cm;
|
||||||
int r;
|
int r;
|
||||||
char *pt;
|
char *pt;
|
||||||
|
char *memblockq_name;
|
||||||
pa_sample_spec ss;
|
pa_sample_spec ss;
|
||||||
pa_channel_map map;
|
pa_channel_map map;
|
||||||
|
|
||||||
|
|
@ -481,22 +482,25 @@ int pa_sink_input_new(
|
||||||
i->thread_info.playing_for = 0;
|
i->thread_info.playing_for = 0;
|
||||||
i->thread_info.direct_outputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
|
i->thread_info.direct_outputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
|
||||||
|
|
||||||
i->thread_info.render_memblockq = pa_memblockq_new(
|
|
||||||
0,
|
|
||||||
MEMBLOCKQ_MAXLENGTH,
|
|
||||||
0,
|
|
||||||
pa_frame_size(&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(core->sink_inputs, i, &i->index) == 0);
|
||||||
pa_assert_se(pa_idxset_put(i->sink->inputs, pa_sink_input_ref(i), NULL) == 0);
|
pa_assert_se(pa_idxset_put(i->sink->inputs, pa_sink_input_ref(i), NULL) == 0);
|
||||||
|
|
||||||
if (i->client)
|
if (i->client)
|
||||||
pa_assert_se(pa_idxset_put(i->client->sink_inputs, i, NULL) >= 0);
|
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,
|
||||||
|
&i->sink->sample_spec,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
&i->sink->silence);
|
||||||
|
pa_xfree(memblockq_name);
|
||||||
|
|
||||||
pt = pa_proplist_to_string_sep(i->proplist, "\n ");
|
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",
|
pa_log_info("Created input %u \"%s\" on %s with sample spec %s and channel map %s\n %s",
|
||||||
i->index,
|
i->index,
|
||||||
|
|
@ -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 */
|
/* Replace resampler and render queue */
|
||||||
if (new_resampler != i->thread_info.resampler) {
|
if (new_resampler != i->thread_info.resampler) {
|
||||||
|
char *memblockq_name;
|
||||||
|
|
||||||
if (i->thread_info.resampler)
|
if (i->thread_info.resampler)
|
||||||
pa_resampler_free(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);
|
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(
|
i->thread_info.render_memblockq = pa_memblockq_new(
|
||||||
|
memblockq_name,
|
||||||
0,
|
0,
|
||||||
MEMBLOCKQ_MAXLENGTH,
|
MEMBLOCKQ_MAXLENGTH,
|
||||||
0,
|
0,
|
||||||
pa_frame_size(&i->sink->sample_spec),
|
&i->sink->sample_spec,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
&i->sink->silence);
|
&i->sink->silence);
|
||||||
|
pa_xfree(memblockq_name);
|
||||||
i->actual_resample_method = new_resampler ? pa_resampler_get_method(new_resampler) : PA_RESAMPLER_INVALID;
|
i->actual_resample_method = new_resampler ? pa_resampler_get_method(new_resampler) : PA_RESAMPLER_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ int pa_play_file(
|
||||||
u->sink_input->userdata = u;
|
u->sink_input->userdata = u;
|
||||||
|
|
||||||
pa_sink_input_get_silence(u->sink_input, &silence);
|
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_memblock_unref(silence.memblock);
|
||||||
|
|
||||||
pa_sink_input_put(u->sink_input);
|
pa_sink_input_put(u->sink_input);
|
||||||
|
|
|
||||||
|
|
@ -443,10 +443,11 @@ int pa_source_output_new(
|
||||||
o->thread_info.direct_on_input = o->direct_on_input;
|
o->thread_info.direct_on_input = o->direct_on_input;
|
||||||
|
|
||||||
o->thread_info.delay_memblockq = pa_memblockq_new(
|
o->thread_info.delay_memblockq = pa_memblockq_new(
|
||||||
|
"source output delay_memblockq",
|
||||||
0,
|
0,
|
||||||
MEMBLOCKQ_MAXLENGTH,
|
MEMBLOCKQ_MAXLENGTH,
|
||||||
0,
|
0,
|
||||||
pa_frame_size(&o->source->sample_spec),
|
&o->source->sample_spec,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
0,
|
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);
|
pa_memblockq_free(o->thread_info.delay_memblockq);
|
||||||
|
|
||||||
o->thread_info.delay_memblockq = pa_memblockq_new(
|
o->thread_info.delay_memblockq = pa_memblockq_new(
|
||||||
|
"source output delay_memblockq",
|
||||||
0,
|
0,
|
||||||
MEMBLOCKQ_MAXLENGTH,
|
MEMBLOCKQ_MAXLENGTH,
|
||||||
0,
|
0,
|
||||||
pa_frame_size(&o->source->sample_spec),
|
&o->source->sample_spec,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,11 @@ int main(int argc, char *argv[]) {
|
||||||
pa_memblockq *bq;
|
pa_memblockq *bq;
|
||||||
pa_memchunk chunk1, chunk2, chunk3, chunk4;
|
pa_memchunk chunk1, chunk2, chunk3, chunk4;
|
||||||
pa_memchunk silence;
|
pa_memchunk silence;
|
||||||
|
pa_sample_spec ss = {
|
||||||
|
.format = PA_SAMPLE_S16LE,
|
||||||
|
.rate = 48000,
|
||||||
|
.channels = 1
|
||||||
|
};
|
||||||
|
|
||||||
pa_log_set_level(PA_LOG_DEBUG);
|
pa_log_set_level(PA_LOG_DEBUG);
|
||||||
|
|
||||||
|
|
@ -86,7 +91,7 @@ int main(int argc, char *argv[]) {
|
||||||
silence.index = 0;
|
silence.index = 0;
|
||||||
silence.length = pa_memblock_get_length(silence.memblock);
|
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);
|
assert(bq);
|
||||||
|
|
||||||
chunk1.memblock = pa_memblock_new_fixed(p, (char*) "11", 2, 1);
|
chunk1.memblock = pa_memblock_new_fixed(p, (char*) "11", 2, 1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue