• Home
  • Raw
  • Download

Lines Matching refs:bq

72     pa_memblockq* bq;  in pa_memblockq_new()  local
77 bq = pa_xnew0(pa_memblockq, 1); in pa_memblockq_new()
78 bq->name = pa_xstrdup(name); in pa_memblockq_new()
80 bq->sample_spec = *sample_spec; in pa_memblockq_new()
81 bq->base = pa_frame_size(sample_spec); in pa_memblockq_new()
82 bq->read_index = bq->write_index = idx; in pa_memblockq_new()
85 …(unsigned long) maxlength, (unsigned long) tlength, (unsigned long) bq->base, (unsigned long) preb… in pa_memblockq_new()
87 bq->in_prebuf = true; in pa_memblockq_new()
89 pa_memblockq_set_maxlength(bq, maxlength); in pa_memblockq_new()
90 pa_memblockq_set_tlength(bq, tlength); in pa_memblockq_new()
91 pa_memblockq_set_minreq(bq, minreq); in pa_memblockq_new()
92 pa_memblockq_set_prebuf(bq, prebuf); in pa_memblockq_new()
93 pa_memblockq_set_maxrewind(bq, maxrewind); in pa_memblockq_new()
96 …ng) bq->maxlength, (unsigned long) bq->tlength, (unsigned long) bq->base, (unsigned long) bq->preb… in pa_memblockq_new()
99 bq->silence = *silence; in pa_memblockq_new()
100 pa_memblock_ref(bq->silence.memblock); in pa_memblockq_new()
103 bq->mcalign = pa_mcalign_new(bq->base); in pa_memblockq_new()
105 return bq; in pa_memblockq_new()
108 void pa_memblockq_free(pa_memblockq* bq) { in pa_memblockq_free() argument
109 pa_assert(bq); in pa_memblockq_free()
111 pa_memblockq_silence(bq); in pa_memblockq_free()
113 if (bq->silence.memblock) in pa_memblockq_free()
114 pa_memblock_unref(bq->silence.memblock); in pa_memblockq_free()
116 if (bq->mcalign) in pa_memblockq_free()
117 pa_mcalign_free(bq->mcalign); in pa_memblockq_free()
119 pa_xfree(bq->name); in pa_memblockq_free()
120 pa_xfree(bq); in pa_memblockq_free()
123 static void fix_current_read(pa_memblockq *bq) { in fix_current_read() argument
124 pa_assert(bq); in fix_current_read()
126 if (PA_UNLIKELY(!bq->blocks)) { in fix_current_read()
127 bq->current_read = NULL; in fix_current_read()
131 if (PA_UNLIKELY(!bq->current_read)) in fix_current_read()
132 bq->current_read = bq->blocks; in fix_current_read()
135 while (PA_UNLIKELY(bq->current_read->index > bq->read_index)) in fix_current_read()
137 if (bq->current_read->prev) in fix_current_read()
138 bq->current_read = bq->current_read->prev; in fix_current_read()
143 …while (PA_LIKELY(bq->current_read != NULL) && PA_UNLIKELY(bq->current_read->index + (int64_t) bq->… in fix_current_read()
144 bq->current_read = bq->current_read->next; in fix_current_read()
151 static void fix_current_write(pa_memblockq *bq) { in fix_current_write() argument
152 pa_assert(bq); in fix_current_write()
154 if (PA_UNLIKELY(!bq->blocks)) { in fix_current_write()
155 bq->current_write = NULL; in fix_current_write()
159 if (PA_UNLIKELY(!bq->current_write)) in fix_current_write()
160 bq->current_write = bq->blocks_tail; in fix_current_write()
163 …while (PA_UNLIKELY(bq->current_write->index + (int64_t) bq->current_write->chunk.length <= bq->wri… in fix_current_write()
165 if (bq->current_write->next) in fix_current_write()
166 bq->current_write = bq->current_write->next; in fix_current_write()
171 …while (PA_LIKELY(bq->current_write != NULL) && PA_UNLIKELY(bq->current_write->index > bq->write_in… in fix_current_write()
172 bq->current_write = bq->current_write->prev; in fix_current_write()
179 static void drop_block(pa_memblockq *bq, struct list_item *q) { in drop_block() argument
180 pa_assert(bq); in drop_block()
183 pa_assert(bq->n_blocks >= 1); in drop_block()
188 pa_assert(bq->blocks == q); in drop_block()
189 bq->blocks = q->next; in drop_block()
195 pa_assert(bq->blocks_tail == q); in drop_block()
196 bq->blocks_tail = q->prev; in drop_block()
199 if (bq->current_write == q) in drop_block()
200 bq->current_write = q->prev; in drop_block()
202 if (bq->current_read == q) in drop_block()
203 bq->current_read = q->next; in drop_block()
210 bq->n_blocks--; in drop_block()
213 static void drop_backlog(pa_memblockq *bq) { in drop_backlog() argument
215 pa_assert(bq); in drop_backlog()
217 boundary = bq->read_index - (int64_t) bq->maxrewind; in drop_backlog()
219 while (bq->blocks && (bq->blocks->index + (int64_t) bq->blocks->chunk.length <= boundary)) in drop_backlog()
220 drop_block(bq, bq->blocks); in drop_backlog()
223 static bool can_push(pa_memblockq *bq, size_t l) { in can_push() argument
226 pa_assert(bq); in can_push()
228 if (bq->read_index > bq->write_index) { in can_push()
229 int64_t d = bq->read_index - bq->write_index; in can_push()
237 …end = bq->blocks_tail ? bq->blocks_tail->index + (int64_t) bq->blocks_tail->chunk.length : bq->wri… in can_push()
240 if (bq->write_index + (int64_t) l > end) in can_push()
241 if (bq->write_index + (int64_t) l - bq->read_index > (int64_t) bq->maxlength) in can_push()
247 static void write_index_changed(pa_memblockq *bq, int64_t old_write_index, bool account) { in write_index_changed() argument
250 pa_assert(bq); in write_index_changed()
252 delta = bq->write_index - old_write_index; in write_index_changed()
255 bq->requested -= delta; in write_index_changed()
257 bq->missing -= delta; in write_index_changed()
260 …d/seeked %lli: requested counter at %lli, account=%i", bq->name, (long long) delta, (long long) bq in write_index_changed()
264 static void read_index_changed(pa_memblockq *bq, int64_t old_read_index) { in read_index_changed() argument
267 pa_assert(bq); in read_index_changed()
269 delta = bq->read_index - old_read_index; in read_index_changed()
270 bq->missing += delta; in read_index_changed()
273 …log_debug("[%s] popped %lli: missing counter at %lli", bq->name, (long long) delta, (long long) bq in read_index_changed()
277 int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) { in pa_memblockq_push() argument
282 pa_assert(bq); in pa_memblockq_push()
288 pa_assert(uchunk->length % bq->base == 0); in pa_memblockq_push()
289 pa_assert(uchunk->index % bq->base == 0); in pa_memblockq_push()
291 if (!can_push(bq, uchunk->length)) in pa_memblockq_push()
294 old = bq->write_index; in pa_memblockq_push()
297 fix_current_write(bq); in pa_memblockq_push()
298 q = bq->current_write; in pa_memblockq_push()
304 while (bq->write_index + (int64_t) chunk.length > q->index) in pa_memblockq_push()
312 q = bq->blocks_tail; in pa_memblockq_push()
319 if (bq->write_index >= q->index + (int64_t) q->chunk.length) in pa_memblockq_push()
322 else if (bq->write_index + (int64_t) chunk.length <= q->index) { in pa_memblockq_push()
325 } else if (bq->write_index <= q->index && in pa_memblockq_push()
326bq->write_index + (int64_t) chunk.length >= q->index + (int64_t) q->chunk.length) { in pa_memblockq_push()
333 drop_block(bq, p); in pa_memblockq_push()
334 } else if (bq->write_index >= q->index) { in pa_memblockq_push()
338 if (bq->write_index + (int64_t) chunk.length < q->index + (int64_t) q->chunk.length) { in pa_memblockq_push()
352 d = (size_t) (bq->write_index + (int64_t) chunk.length - q->index); in pa_memblockq_push()
364 bq->blocks_tail = p; in pa_memblockq_push()
367 bq->n_blocks++; in pa_memblockq_push()
371 if (!(q->chunk.length = (size_t) (bq->write_index - q->index))) { in pa_memblockq_push()
375 drop_block(bq, p); in pa_memblockq_push()
383 pa_assert(bq->write_index + (int64_t)chunk.length > q->index && in pa_memblockq_push()
384bq->write_index + (int64_t)chunk.length < q->index + (int64_t)q->chunk.length && in pa_memblockq_push()
385 bq->write_index < q->index); in pa_memblockq_push()
389 d = (size_t) (bq->write_index + (int64_t) chunk.length - q->index); in pa_memblockq_push()
399 pa_assert(bq->write_index >= q->index + (int64_t)q->chunk.length); in pa_memblockq_push()
400 pa_assert(!q->next || (bq->write_index + (int64_t)chunk.length <= q->next->index)); in pa_memblockq_push()
406 bq->write_index == q->index + (int64_t) q->chunk.length) { in pa_memblockq_push()
409 bq->write_index += (int64_t) chunk.length; in pa_memblockq_push()
413 pa_assert(!bq->blocks || (bq->write_index + (int64_t)chunk.length <= bq->blocks->index)); in pa_memblockq_push()
420 n->index = bq->write_index; in pa_memblockq_push()
421 bq->write_index += (int64_t) n->chunk.length; in pa_memblockq_push()
423 n->next = q ? q->next : bq->blocks; in pa_memblockq_push()
429 bq->blocks_tail = n; in pa_memblockq_push()
434 bq->blocks = n; in pa_memblockq_push()
436 bq->n_blocks++; in pa_memblockq_push()
440 write_index_changed(bq, old, true); in pa_memblockq_push()
444 bool pa_memblockq_prebuf_active(pa_memblockq *bq) { in pa_memblockq_prebuf_active() argument
445 pa_assert(bq); in pa_memblockq_prebuf_active()
447 if (bq->in_prebuf) in pa_memblockq_prebuf_active()
448 return pa_memblockq_get_length(bq) < bq->prebuf; in pa_memblockq_prebuf_active()
450 return bq->prebuf > 0 && bq->read_index >= bq->write_index; in pa_memblockq_prebuf_active()
453 static bool update_prebuf(pa_memblockq *bq) { in update_prebuf() argument
454 pa_assert(bq); in update_prebuf()
456 if (bq->in_prebuf) { in update_prebuf()
458 if (pa_memblockq_get_length(bq) < bq->prebuf) in update_prebuf()
461 bq->in_prebuf = false; in update_prebuf()
465 if (bq->prebuf > 0 && bq->read_index >= bq->write_index) { in update_prebuf()
466 bq->in_prebuf = true; in update_prebuf()
474 int pa_memblockq_peek(pa_memblockq* bq, pa_memchunk *chunk) { in pa_memblockq_peek() argument
476 pa_assert(bq); in pa_memblockq_peek()
480 if (update_prebuf(bq)) in pa_memblockq_peek()
483 fix_current_read(bq); in pa_memblockq_peek()
486 if (!bq->current_read || bq->current_read->index > bq->read_index) { in pa_memblockq_peek()
490 if (bq->current_read) in pa_memblockq_peek()
491 length = (size_t) (bq->current_read->index - bq->read_index); in pa_memblockq_peek()
492 else if (bq->write_index > bq->read_index) in pa_memblockq_peek()
493 length = (size_t) (bq->write_index - bq->read_index); in pa_memblockq_peek()
498 if (bq->silence.memblock) { in pa_memblockq_peek()
499 *chunk = bq->silence; in pa_memblockq_peek()
521 *chunk = bq->current_read->chunk; in pa_memblockq_peek()
524 pa_assert(bq->read_index >= bq->current_read->index); in pa_memblockq_peek()
525 d = bq->read_index - bq->current_read->index; in pa_memblockq_peek()
532 int pa_memblockq_peek_fixed_size(pa_memblockq *bq, size_t block_size, pa_memchunk *chunk) { in pa_memblockq_peek_fixed_size() argument
538 pa_assert(bq); in pa_memblockq_peek_fixed_size()
541 pa_assert(bq->silence.memblock); in pa_memblockq_peek_fixed_size()
543 if (pa_memblockq_peek(bq, &tchunk) < 0) in pa_memblockq_peek_fixed_size()
565 item = bq->current_read; in pa_memblockq_peek_fixed_size()
566 ri = bq->read_index + tchunk.length; in pa_memblockq_peek_fixed_size()
572 tchunk = bq->silence; in pa_memblockq_peek_fixed_size()
605 void pa_memblockq_drop(pa_memblockq *bq, size_t length) { in pa_memblockq_drop() argument
607 pa_assert(bq); in pa_memblockq_drop()
608 pa_assert(length % bq->base == 0); in pa_memblockq_drop()
610 old = bq->read_index; in pa_memblockq_drop()
615 if (update_prebuf(bq)) in pa_memblockq_drop()
618 fix_current_read(bq); in pa_memblockq_drop()
620 if (bq->current_read) { in pa_memblockq_drop()
626 p = bq->current_read->index + (int64_t) bq->current_read->chunk.length; in pa_memblockq_drop()
627 pa_assert(p >= bq->read_index); in pa_memblockq_drop()
628 d = p - bq->read_index; in pa_memblockq_drop()
633 bq->read_index += d; in pa_memblockq_drop()
639 bq->read_index += (int64_t) length; in pa_memblockq_drop()
644 drop_backlog(bq); in pa_memblockq_drop()
645 read_index_changed(bq, old); in pa_memblockq_drop()
648 void pa_memblockq_rewind(pa_memblockq *bq, size_t length) { in pa_memblockq_rewind() argument
650 pa_assert(bq); in pa_memblockq_rewind()
651 pa_assert(length % bq->base == 0); in pa_memblockq_rewind()
653 old = bq->read_index; in pa_memblockq_rewind()
657 bq->read_index -= (int64_t) length; in pa_memblockq_rewind()
659 read_index_changed(bq, old); in pa_memblockq_rewind()
662 bool pa_memblockq_is_readable(pa_memblockq *bq) { in pa_memblockq_is_readable() argument
663 pa_assert(bq); in pa_memblockq_is_readable()
665 if (pa_memblockq_prebuf_active(bq)) in pa_memblockq_is_readable()
668 if (pa_memblockq_get_length(bq) <= 0) in pa_memblockq_is_readable()
674 size_t pa_memblockq_get_length(pa_memblockq *bq) { in pa_memblockq_get_length() argument
675 pa_assert(bq); in pa_memblockq_get_length()
677 if (bq->write_index <= bq->read_index) in pa_memblockq_get_length()
680 return (size_t) (bq->write_index - bq->read_index); in pa_memblockq_get_length()
683 void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, bool account) { in pa_memblockq_seek() argument
685 pa_assert(bq); in pa_memblockq_seek()
687 old = bq->write_index; in pa_memblockq_seek()
691 bq->write_index += offset; in pa_memblockq_seek()
694 bq->write_index = offset; in pa_memblockq_seek()
697 bq->write_index = bq->read_index + offset; in pa_memblockq_seek()
700bq->write_index = (bq->blocks_tail ? bq->blocks_tail->index + (int64_t) bq->blocks_tail->chunk.len… in pa_memblockq_seek()
706 drop_backlog(bq); in pa_memblockq_seek()
707 write_index_changed(bq, old, account); in pa_memblockq_seek()
710 void pa_memblockq_flush_write(pa_memblockq *bq, bool account) { in pa_memblockq_flush_write() argument
712 pa_assert(bq); in pa_memblockq_flush_write()
714 pa_memblockq_silence(bq); in pa_memblockq_flush_write()
716 old = bq->write_index; in pa_memblockq_flush_write()
717 bq->write_index = bq->read_index; in pa_memblockq_flush_write()
719 pa_memblockq_prebuf_force(bq); in pa_memblockq_flush_write()
720 write_index_changed(bq, old, account); in pa_memblockq_flush_write()
723 void pa_memblockq_flush_read(pa_memblockq *bq) { in pa_memblockq_flush_read() argument
725 pa_assert(bq); in pa_memblockq_flush_read()
727 pa_memblockq_silence(bq); in pa_memblockq_flush_read()
729 old = bq->read_index; in pa_memblockq_flush_read()
730 bq->read_index = bq->write_index; in pa_memblockq_flush_read()
732 pa_memblockq_prebuf_force(bq); in pa_memblockq_flush_read()
733 read_index_changed(bq, old); in pa_memblockq_flush_read()
736 size_t pa_memblockq_get_tlength(pa_memblockq *bq) { in pa_memblockq_get_tlength() argument
737 pa_assert(bq); in pa_memblockq_get_tlength()
739 return bq->tlength; in pa_memblockq_get_tlength()
742 size_t pa_memblockq_get_minreq(pa_memblockq *bq) { in pa_memblockq_get_minreq() argument
743 pa_assert(bq); in pa_memblockq_get_minreq()
745 return bq->minreq; in pa_memblockq_get_minreq()
748 size_t pa_memblockq_get_maxrewind(pa_memblockq *bq) { in pa_memblockq_get_maxrewind() argument
749 pa_assert(bq); in pa_memblockq_get_maxrewind()
751 return bq->maxrewind; in pa_memblockq_get_maxrewind()
754 int64_t pa_memblockq_get_read_index(pa_memblockq *bq) { in pa_memblockq_get_read_index() argument
755 pa_assert(bq); in pa_memblockq_get_read_index()
757 return bq->read_index; in pa_memblockq_get_read_index()
760 int64_t pa_memblockq_get_write_index(pa_memblockq *bq) { in pa_memblockq_get_write_index() argument
761 pa_assert(bq); in pa_memblockq_get_write_index()
763 return bq->write_index; in pa_memblockq_get_write_index()
766 int pa_memblockq_push_align(pa_memblockq* bq, const pa_memchunk *chunk) { in pa_memblockq_push_align() argument
769 pa_assert(bq); in pa_memblockq_push_align()
772 if (bq->base == 1) in pa_memblockq_push_align()
773 return pa_memblockq_push(bq, chunk); in pa_memblockq_push_align()
775 if (!can_push(bq, pa_mcalign_csize(bq->mcalign, chunk->length))) in pa_memblockq_push_align()
778 pa_mcalign_push(bq->mcalign, chunk); in pa_memblockq_push_align()
780 while (pa_mcalign_pop(bq->mcalign, &rchunk) >= 0) { in pa_memblockq_push_align()
782 r = pa_memblockq_push(bq, &rchunk); in pa_memblockq_push_align()
786 pa_mcalign_flush(bq->mcalign); in pa_memblockq_push_align()
794 void pa_memblockq_prebuf_disable(pa_memblockq *bq) { in pa_memblockq_prebuf_disable() argument
795 pa_assert(bq); in pa_memblockq_prebuf_disable()
797 bq->in_prebuf = false; in pa_memblockq_prebuf_disable()
800 void pa_memblockq_prebuf_force(pa_memblockq *bq) { in pa_memblockq_prebuf_force() argument
801 pa_assert(bq); in pa_memblockq_prebuf_force()
803 if (bq->prebuf > 0) in pa_memblockq_prebuf_force()
804 bq->in_prebuf = true; in pa_memblockq_prebuf_force()
807 size_t pa_memblockq_get_maxlength(pa_memblockq *bq) { in pa_memblockq_get_maxlength() argument
808 pa_assert(bq); in pa_memblockq_get_maxlength()
810 return bq->maxlength; in pa_memblockq_get_maxlength()
813 size_t pa_memblockq_get_prebuf(pa_memblockq *bq) { in pa_memblockq_get_prebuf() argument
814 pa_assert(bq); in pa_memblockq_get_prebuf()
816 return bq->prebuf; in pa_memblockq_get_prebuf()
819 size_t pa_memblockq_pop_missing(pa_memblockq *bq) { in pa_memblockq_pop_missing() argument
822 pa_assert(bq); in pa_memblockq_pop_missing()
825 pa_log_debug("[%s] pop: %lli", bq->name, (long long) bq->missing); in pa_memblockq_pop_missing()
828 if (bq->missing <= 0) in pa_memblockq_pop_missing()
831 if (((size_t) bq->missing < bq->minreq) && in pa_memblockq_pop_missing()
832 !pa_memblockq_prebuf_active(bq)) in pa_memblockq_pop_missing()
835 l = (size_t) bq->missing; in pa_memblockq_pop_missing()
837 bq->requested += bq->missing; in pa_memblockq_pop_missing()
838 bq->missing = 0; in pa_memblockq_pop_missing()
841 …_log_debug("[%s] sent %lli: request counter is at %lli", bq->name, (long long) l, (long long) bq->… in pa_memblockq_pop_missing()
847 void pa_memblockq_set_maxlength(pa_memblockq *bq, size_t maxlength) { in pa_memblockq_set_maxlength() argument
848 pa_assert(bq); in pa_memblockq_set_maxlength()
850 bq->maxlength = ((maxlength+bq->base-1)/bq->base)*bq->base; in pa_memblockq_set_maxlength()
852 if (bq->maxlength < bq->base) in pa_memblockq_set_maxlength()
853 bq->maxlength = bq->base; in pa_memblockq_set_maxlength()
855 if (bq->tlength > bq->maxlength) in pa_memblockq_set_maxlength()
856 pa_memblockq_set_tlength(bq, bq->maxlength); in pa_memblockq_set_maxlength()
859 void pa_memblockq_set_tlength(pa_memblockq *bq, size_t tlength) { in pa_memblockq_set_tlength() argument
861 pa_assert(bq); in pa_memblockq_set_tlength()
864 tlength = bq->maxlength; in pa_memblockq_set_tlength()
866 old_tlength = bq->tlength; in pa_memblockq_set_tlength()
867 bq->tlength = ((tlength+bq->base-1)/bq->base)*bq->base; in pa_memblockq_set_tlength()
869 if (bq->tlength > bq->maxlength) in pa_memblockq_set_tlength()
870 bq->tlength = bq->maxlength; in pa_memblockq_set_tlength()
872 if (bq->minreq > bq->tlength) in pa_memblockq_set_tlength()
873 pa_memblockq_set_minreq(bq, bq->tlength); in pa_memblockq_set_tlength()
875 if (bq->prebuf > bq->tlength+bq->base-bq->minreq) in pa_memblockq_set_tlength()
876 pa_memblockq_set_prebuf(bq, bq->tlength+bq->base-bq->minreq); in pa_memblockq_set_tlength()
878 bq->missing += (int64_t) bq->tlength - (int64_t) old_tlength; in pa_memblockq_set_tlength()
881 void pa_memblockq_set_minreq(pa_memblockq *bq, size_t minreq) { in pa_memblockq_set_minreq() argument
882 pa_assert(bq); in pa_memblockq_set_minreq()
884 bq->minreq = (minreq/bq->base)*bq->base; in pa_memblockq_set_minreq()
886 if (bq->minreq > bq->tlength) in pa_memblockq_set_minreq()
887 bq->minreq = bq->tlength; in pa_memblockq_set_minreq()
889 if (bq->minreq < bq->base) in pa_memblockq_set_minreq()
890 bq->minreq = bq->base; in pa_memblockq_set_minreq()
892 if (bq->prebuf > bq->tlength+bq->base-bq->minreq) in pa_memblockq_set_minreq()
893 pa_memblockq_set_prebuf(bq, bq->tlength+bq->base-bq->minreq); in pa_memblockq_set_minreq()
896 void pa_memblockq_set_prebuf(pa_memblockq *bq, size_t prebuf) { in pa_memblockq_set_prebuf() argument
897 pa_assert(bq); in pa_memblockq_set_prebuf()
900 prebuf = bq->tlength+bq->base-bq->minreq; in pa_memblockq_set_prebuf()
902 bq->prebuf = ((prebuf+bq->base-1)/bq->base)*bq->base; in pa_memblockq_set_prebuf()
904 if (prebuf > 0 && bq->prebuf < bq->base) in pa_memblockq_set_prebuf()
905 bq->prebuf = bq->base; in pa_memblockq_set_prebuf()
907 if (bq->prebuf > bq->tlength+bq->base-bq->minreq) in pa_memblockq_set_prebuf()
908 bq->prebuf = bq->tlength+bq->base-bq->minreq; in pa_memblockq_set_prebuf()
910 if (bq->prebuf <= 0 || pa_memblockq_get_length(bq) >= bq->prebuf) in pa_memblockq_set_prebuf()
911 bq->in_prebuf = false; in pa_memblockq_set_prebuf()
914 void pa_memblockq_set_maxrewind(pa_memblockq *bq, size_t maxrewind) { in pa_memblockq_set_maxrewind() argument
915 pa_assert(bq); in pa_memblockq_set_maxrewind()
917 bq->maxrewind = (maxrewind/bq->base)*bq->base; in pa_memblockq_set_maxrewind()
920 void pa_memblockq_apply_attr(pa_memblockq *bq, const pa_buffer_attr *a) { in pa_memblockq_apply_attr() argument
921 pa_assert(bq); in pa_memblockq_apply_attr()
924 pa_memblockq_set_maxlength(bq, a->maxlength); in pa_memblockq_apply_attr()
925 pa_memblockq_set_tlength(bq, a->tlength); in pa_memblockq_apply_attr()
926 pa_memblockq_set_minreq(bq, a->minreq); in pa_memblockq_apply_attr()
927 pa_memblockq_set_prebuf(bq, a->prebuf); in pa_memblockq_apply_attr()
930 void pa_memblockq_get_attr(pa_memblockq *bq, pa_buffer_attr *a) { in pa_memblockq_get_attr() argument
931 pa_assert(bq); in pa_memblockq_get_attr()
934 a->maxlength = (uint32_t) pa_memblockq_get_maxlength(bq); in pa_memblockq_get_attr()
935 a->tlength = (uint32_t) pa_memblockq_get_tlength(bq); in pa_memblockq_get_attr()
936 a->prebuf = (uint32_t) pa_memblockq_get_prebuf(bq); in pa_memblockq_get_attr()
937 a->minreq = (uint32_t) pa_memblockq_get_minreq(bq); in pa_memblockq_get_attr()
940 int pa_memblockq_splice(pa_memblockq *bq, pa_memblockq *source) { in pa_memblockq_splice() argument
942 pa_assert(bq); in pa_memblockq_splice()
945 pa_memblockq_prebuf_disable(bq); in pa_memblockq_splice()
957 if (pa_memblockq_push_align(bq, &chunk) < 0) { in pa_memblockq_splice()
964 pa_memblockq_seek(bq, (int64_t) chunk.length, PA_SEEK_RELATIVE, true); in pa_memblockq_splice()
966 pa_memblockq_drop(bq, chunk.length); in pa_memblockq_splice()
970 void pa_memblockq_willneed(pa_memblockq *bq) { in pa_memblockq_willneed() argument
973 pa_assert(bq); in pa_memblockq_willneed()
975 fix_current_read(bq); in pa_memblockq_willneed()
977 for (q = bq->current_read; q; q = q->next) in pa_memblockq_willneed()
981 void pa_memblockq_set_silence(pa_memblockq *bq, pa_memchunk *silence) { in pa_memblockq_set_silence() argument
982 pa_assert(bq); in pa_memblockq_set_silence()
984 if (bq->silence.memblock) in pa_memblockq_set_silence()
985 pa_memblock_unref(bq->silence.memblock); in pa_memblockq_set_silence()
988 bq->silence = *silence; in pa_memblockq_set_silence()
989 pa_memblock_ref(bq->silence.memblock); in pa_memblockq_set_silence()
991 pa_memchunk_reset(&bq->silence); in pa_memblockq_set_silence()
994 bool pa_memblockq_is_empty(pa_memblockq *bq) { in pa_memblockq_is_empty() argument
995 pa_assert(bq); in pa_memblockq_is_empty()
997 return !bq->blocks; in pa_memblockq_is_empty()
1000 void pa_memblockq_silence(pa_memblockq *bq) { in pa_memblockq_silence() argument
1001 pa_assert(bq); in pa_memblockq_silence()
1003 while (bq->blocks) in pa_memblockq_silence()
1004 drop_block(bq, bq->blocks); in pa_memblockq_silence()
1006 pa_assert(bq->n_blocks == 0); in pa_memblockq_silence()
1009 unsigned pa_memblockq_get_nblocks(pa_memblockq *bq) { in pa_memblockq_get_nblocks() argument
1010 pa_assert(bq); in pa_memblockq_get_nblocks()
1012 return bq->n_blocks; in pa_memblockq_get_nblocks()
1015 size_t pa_memblockq_get_base(pa_memblockq *bq) { in pa_memblockq_get_base() argument
1016 pa_assert(bq); in pa_memblockq_get_base()
1018 return bq->base; in pa_memblockq_get_base()