[alsa-devel] [PATCH] alsa-plugins/pulse: Implement 'pause'.

Lennart Poettering mznyfn at 0pointer.de
Wed Jun 17 23:37:55 CEST 2009


On Wed, 17.06.09 21:55, Troy Moure (twmoure at szypr.net) wrote:

> Just cork or uncork the stream to pause or unpause it.

Looks mostly good to me, but:

> +static int pulse_pause(snd_pcm_ioplug_t * io, int enable)
> +{
> +	snd_pcm_pulse_t *pcm = io->private_data;
> +	int err = 0;
> +
> +	assert (pcm);
> +	assert (pcm->p);
> +
> +	pa_threaded_mainloop_lock(pcm->p->mainloop);
> +
> +	if (pcm->stream)
> +		if (!pa_stream_cork(pcm->stream, enable, NULL, NULL))
> +			err = -EIO;

pa_stream_cork() will return a pa_operation object on success. The
least you need to do is call pa_operation_unref() on it, which you can
safely do right-away. Otherwise this will leak memory.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4


More information about the Alsa-devel mailing list