mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
alsa: Precompute maximum frames per block
frames_per_block is the mempool's maximum block size in frames v2 (thanks David Henningson) * rename max_frames to frames_per_block Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
This commit is contained in:
parent
101092465d
commit
8bbdae0ae8
2 changed files with 8 additions and 4 deletions
|
|
@ -116,6 +116,8 @@ struct userdata {
|
|||
watermark_inc_threshold,
|
||||
watermark_dec_threshold;
|
||||
|
||||
snd_pcm_uframes_t frames_per_block;
|
||||
|
||||
pa_usec_t watermark_dec_not_before;
|
||||
pa_usec_t min_latency_ref;
|
||||
pa_usec_t tsched_watermark_usec;
|
||||
|
|
@ -576,8 +578,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, bool polled, boo
|
|||
}
|
||||
|
||||
/* Make sure that if these memblocks need to be copied they will fit into one slot */
|
||||
if (frames > pa_mempool_block_size_max(u->core->mempool)/u->frame_size)
|
||||
frames = pa_mempool_block_size_max(u->core->mempool)/u->frame_size;
|
||||
frames = PA_MIN(frames, u->frames_per_block);
|
||||
|
||||
if (!after_avail && frames == 0)
|
||||
break;
|
||||
|
|
@ -2033,6 +2034,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
|
|||
pa_source_set_rtpoll(u->source, u->rtpoll);
|
||||
|
||||
u->frame_size = frame_size;
|
||||
u->frames_per_block = pa_mempool_block_size_max(m->core->mempool) / frame_size;
|
||||
u->fragment_size = frag_size = (size_t) (period_frames * frame_size);
|
||||
u->hwbuf_size = buffer_size = (size_t) (buffer_frames * frame_size);
|
||||
pa_cvolume_mute(&u->hardware_volume, u->source->sample_spec.channels);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue