alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Jaroslav Kysela <perex@perex.cz>
To: Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	Takashi Iwai <tiwai@suse.de>
Cc: Pavel Hofman <pavel.hofman@ivitera.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: Functionality of pcm_notify in snd-aloop?
Date: Thu, 30 Apr 2020 14:17:56 +0200	[thread overview]
Message-ID: <f6fa39ec-9675-ce3c-c77e-3a438433ea6b@perex.cz> (raw)
In-Reply-To: <alpine.DEB.2.21.2004281910520.2957@eliteleevi.tm.intel.com>

Dne 28. 04. 20 v 18:19 Kai Vehmanen napsal(a):
> Hey,
> 
> On Tue, 28 Apr 2020, Takashi Iwai wrote:
> 
>> I believe the missing piece here is a generic way to tell user-space
>> that the stream got invalidated.  This would be useful not only for
>> aloop but can be applied in general when a stream becomes temporarily
>> unavailable (e.g. the HDMI monitor disconnected or the DSP route
>> switched).
> 
> ack on that. I've been preparing this patch to add -ENODATA to alsa-lib
> documentation:
> "[RFC] pcm: add documentation for -ENODATA error code handling"
> https://github.com/kv2019i/alsa-lib/commit/87b298106e04054489ee93b26a610e37f99a3171
> 
> Have not yet had time to send a proper version to the list, but it's
> addressing specifically this need. This would serve as the interface for
> SOF DSP to tell that a given PCM node will not be providing data (as the
> DSP topology is not fully connected) [1].
> 
> To test the above, I've used a small hack to aplay/arecord that keeps
> trying to restart the PCM after a delay, in case -ENODATA is returned:
> https://github.com/kv2019i/alsa-utils/commit/a2ba541ea0b3e86a65687de88a41f10cf0a8ddc2

This code calls wrongly snd_pcm_resume() here. Also, we should really think 
about the whole mechanism when the stream cannot be activated (also for 
playback - Intel HDMI LPE driver [2]). I mean that the poll multiplexer should 
handle this state, too. If we don't find a way to notify the user space that 
the stream can be started using the poll(), we can use another interface like 
control API for the notifications.

We may also instroduce a new PCM state "WAIT" to wait on the hardware / link 
availability (SETUP -> -ENODATA -> WAIT -> use poll() for the link status -> 
success -> SETUP -> PREPARE) - talking about SNDRV_PCM_STATE states here.

					Jaroslav


> [1] https://github.com/thesofproject/sof/issues/2564

[2] 
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/36a4923f9bd05d4c5e2e8b1765f18edf452b9251/src/modules/alsa/module-alsa-card.c#L928-933


-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

  reply	other threads:[~2020-04-30 12:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 17:19 Functionality of pcm_notify in snd-aloop? Pavel Hofman
2020-03-26 17:44 ` Jaroslav Kysela
2020-03-26 17:59   ` Pavel Hofman
2020-03-30 14:43     ` Pavel Hofman
2020-03-30 15:09       ` Jaroslav Kysela
2020-03-31 15:07         ` Pavel Hofman
2020-04-28 15:44         ` Takashi Iwai
2020-04-28 16:19           ` Kai Vehmanen
2020-04-30 12:17             ` Jaroslav Kysela [this message]
2020-04-30 17:36               ` Kai Vehmanen

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=f6fa39ec-9675-ce3c-c77e-3a438433ea6b@perex.cz \
    --to=perex@perex.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=pavel.hofman@ivitera.com \
    --cc=tiwai@suse.de \
    /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).