diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c index 18066f7..2162870 100644 --- a/src/pulsecore/memblockq.c +++ b/src/pulsecore/memblockq.c @@ -282,6 +282,19 @@ static void read_index_changed(pa_memblockq *bq, int64_t old_read_index) { #endif } +static void dump_memblockq(pa_memblockq *bq) { + struct list_item *q = bq->blocks; + + pa_log("memblockq dump: [%s] rindex: %" PRId64 ", windex: %" PRId64, bq->name, bq->read_index, bq->write_index); + + while (q) { + pa_log(" -> block: index: %" PRId64 ", length: %lu%s%s", q->index, q->chunk.length, + q == bq->current_read ? " (current read)" : "", + q == bq->current_write ? " (current write)" : ""); + q = q->next; + } +} + int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) { struct list_item *q, *n; pa_memchunk chunk; @@ -417,8 +430,13 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) { bq->write_index += (int64_t) chunk.length; goto finish; } - } else - pa_assert(!bq->blocks || (bq->write_index + (int64_t)chunk.length <= bq->blocks->index)); + } else { + if(bq->blocks && (bq->write_index + (int64_t)chunk.length <= bq->blocks->index)) { + dump_memblockq(bq); + pa_log("current chunk length: %lu", chunk.length); + pa_assert_not_reached(); + } + } if (!(n = pa_flist_pop(PA_STATIC_FLIST_GET(list_items)))) n = pa_xnew(struct list_item, 1);