Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lennart Poettering <mznyfn@0pointer.de>
To: Troy Moure <twmoure@szypr.net>
Cc: Takashi Iwai <tiwai@suse.de>,
	alsa-devel@alsa-project.org, patch@alsa-project.org
Subject: Re: [PATCH] alsa-plugins/pulse: Implement 'pause'.
Date: Wed, 17 Jun 2009 23:37:55 +0200	[thread overview]
Message-ID: <20090617213755.GB23735@tango.0pointer.de> (raw)
In-Reply-To: <alpine.LFD.2.00.0906172120550.20793@troy-laptop>

On Wed, 17.06.09 21:55, Troy Moure (twmoure@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

  reply	other threads:[~2009-06-17 21:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-17 20:55 [PATCH] alsa-plugins/pulse: Implement 'pause' Troy Moure
2009-06-17 21:37 ` Lennart Poettering [this message]
     [not found]   ` <alpine.LFD.2.00.0906181444420.6800@troy-laptop>
2009-06-18 14:40     ` [PATCH v2] " Lennart Poettering
2009-06-18 16:15     ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090617213755.GB23735@tango.0pointer.de \
    --to=mznyfn@0pointer.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=patch@alsa-project.org \
    --cc=tiwai@suse.de \
    --cc=twmoure@szypr.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox