mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05: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
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue