src/modules/alsa/alsa-sink.c | 6 ++++-- src/modules/alsa/alsa-source.c | 6 ++++-- src/pulsecore/iochannel.c | 2 -- src/pulsecore/mix.c | 6 +++--- 4 files changed, 11 insertions(+), 9 deletions(-)
New commits: commit b5b4a1078cfeb4f35ab808a1a2be9208bd4595fe Author: Peter Meerwald <[email protected]> Date: Sun Nov 2 17:37:04 2014 +0100 mix: Length over all chunk has already been computed by the caller Signed-off-by: Peter Meerwald <[email protected]> diff --git a/src/pulsecore/mix.c b/src/pulsecore/mix.c index 861f76b..c66a2ec 100644 --- a/src/pulsecore/mix.c +++ b/src/pulsecore/mix.c @@ -641,9 +641,8 @@ size_t pa_mix( } for (k = 0; k < nstreams; k++) { + pa_assert(length <= streams[k].chunk.length); streams[k].ptr = pa_memblock_acquire_chunk(&streams[k].chunk); - if (length > streams[k].chunk.length) - length = streams[k].chunk.length; } calc_stream_volumes_table[spec->format](streams, nstreams, volume, spec); commit 3963fc5e5b04433bfcfccd0f85eecec1d0182c0f Author: Peter Meerwald <[email protected]> Date: Sun Nov 2 17:22:19 2014 +0100 mix: pa_mix() is always called with more than one steam Signed-off-by: Peter Meerwald <[email protected]> diff --git a/src/pulsecore/mix.c b/src/pulsecore/mix.c index 4a839ec..861f76b 100644 --- a/src/pulsecore/mix.c +++ b/src/pulsecore/mix.c @@ -630,11 +630,12 @@ size_t pa_mix( pa_assert(data); pa_assert(length); pa_assert(spec); + pa_assert(nstreams > 1); if (!volume) volume = pa_cvolume_reset(&full_volume, spec->channels); - if (mute || pa_cvolume_is_muted(volume) || nstreams <= 0) { + if (mute || pa_cvolume_is_muted(volume)) { pa_silence_memory(data, length, spec); return length; } commit ea5cbec0b76d847a88f19ad7862fc195b9e59401 Author: Peter Meerwald <[email protected]> Date: Sun Nov 2 23:14:00 2014 +0100 iochannel: Remove unnecessary zero-initialization Signed-off-by: Peter Meerwald <[email protected]> diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c index ae9b42c..93cd0fd 100644 --- a/src/pulsecore/iochannel.c +++ b/src/pulsecore/iochannel.c @@ -412,11 +412,9 @@ ssize_t pa_iochannel_read_with_ancil_data(pa_iochannel*io, void*data, size_t l, return pa_iochannel_read(io, data, l); } - pa_zero(iov); iov.iov_base = data; iov.iov_len = l; - pa_zero(cmsg); pa_zero(mh); mh.msg_iov = &iov; mh.msg_iovlen = 1; commit 8bbdae0ae879eb15999b6b38bc21fc7c9ceff012 Author: Peter Meerwald <[email protected]> Date: Tue Nov 4 15:10:50 2014 +0100 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 <[email protected]> diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 01c3a66..31863c4 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -127,6 +127,8 @@ struct userdata { watermark_dec_threshold, rewind_safeguard; + 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; @@ -619,8 +621,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bo } /* 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; @@ -2328,6 +2329,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca pa_sink_set_rtpoll(u->sink, 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->sink->sample_spec.channels); diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index aa47c3f..8fb74df 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -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); _______________________________________________ pulseaudio-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
