alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: John Lindgren <john.lindgren@tds.net>
To: James Courtier-Dutton <james.dutton@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] alsa-lib: snd_pcm_delay and friends do not account for a write being currently in progress
Date: Thu, 03 Jun 2010 14:06:57 -0400	[thread overview]
Message-ID: <1275588417.20342.18.camel@satellite> (raw)
In-Reply-To: <AANLkTilcRfntO-8vmOCIlFdlLSeyNxd3fJR_8RgfmWNa@mail.gmail.com>

On Thu, 2010-06-03 at 17:34 +0100, James Courtier-Dutton wrote:
> On 3 June 2010 17:10, John Lindgren <john.lindgren@tds.net> wrote:
> >
> > I understand that snd_pcm_delay and snd_pcm_writei currently "interfere
> > with each other" in that snd_pcm_delay returns wrong values if called
> > during snd_pcm_writei.  That is the problem my patch tries to correct.
> > Do you disagree with this improvement?  If so, why?
> 
> I disagree because I believe the changes are unnecessary.
> The alsa api is big enough already, so adding anything extra must have
> an extremely good reason for it.

I thought there was good enough reason, but I won't argue the point.

> snd_pcm_writei and snd_pcm_delay were always intended to be used in
> the same thread.
> Calling snd_pcm_writei and snd_pcm_delay at the same time is
> non-deterministic so fairly pointless to do.

All you're saying is that because it currently doesn't work, it's
pointless to make it work.

> Adding more locks just makes another hit on performances so should be avoided.
> Locks really kill performance on a multi processor SMP machine.

The locks have to be there somewhere; it's just a question of whether
that will be on the application side or the ALSA side.  We have an
interface running in one thread, and an audio decoder running in
another.  As long as output time is calculated from written time +
delay, there must be some thread interaction to ensure that those values
are in sync.

> I would argue that modifying your program to fit in the the above
> contraints is the way to go.

That will be ugly, but it seems that is what I will have to do.

John Lindgren

  reply	other threads:[~2010-06-03 18:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-02 21:29 [PATCH] alsa-lib: snd_pcm_delay and friends do not account for a write being currently in progress John Lindgren
2010-06-03  6:40 ` Clemens Ladisch
2010-06-03 14:00   ` John Lindgren
2010-06-03 14:48     ` Clemens Ladisch
2010-06-03 16:16       ` John Lindgren
2010-06-03 17:03         ` Clemens Ladisch
2010-06-03 17:51           ` John Lindgren
2010-06-03 14:40 ` [PATCH] " James Courtier-Dutton
2010-06-03 16:10   ` John Lindgren
2010-06-03 16:34     ` James Courtier-Dutton
2010-06-03 18:06       ` John Lindgren [this message]
2010-06-03 17:40 ` VDR User
2010-06-03 18:08   ` John Lindgren
2010-06-04  6:50   ` Clemens Ladisch

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=1275588417.20342.18.camel@satellite \
    --to=john.lindgren@tds.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=james.dutton@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).