[pulseaudio-discuss] [RFC] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_START failed (-77) proposed fix to check pcm state

Raymond Yau superquad.vortex2 at gmail.com
Fri Nov 28 02:06:37 PST 2014


> On the other hand, I have suspicion that it is an ALSA bug that you are
possibly trying to work around. Is it that no other plugins end up in the
already-running state, or that all other plugins ignore snd_pcm_start()
when they are already started?

int snd_pcm_sw_params_set_start_threshold ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params, snd_pcm_uframes_t val )

val is snd_pcm_uframes_t,  negative number is not  valid parameter

http://git.alsa-project.org/?p=alsa-lib.git;a=blob_plain;f=src/pcm/pcm.c;hb=HEAD

In function snd_pcm_write_areas() ,

snd_pcm_sframes_t hw_avail = pcm->buffer_size - avail;
hw_avail += frames;
/* some plugins might automatically start the stream */
state = snd_pcm_state(pcm);
if (state == SND_PCM_STATE_PREPARED &&
    hw_avail >= (snd_pcm_sframes_t) pcm->start_threshold) {
err = snd_pcm_start(pcm);
if (err < 0)
goto _end;
}

>
> It would be very nice if you isolate the hardware and software parameters
that PulseAudio tries to apply, write a simple ALSA test program that
applies them, possibly writes some sound data and calls snd_pcm_start(),
and test all available plugins using that program, so that we know whether
this is limited to the multi plugin.
>

http://mailman.alsa-project.org/pipermail/alsa-devel/2014-September/081501.html

Using your program pcm_avail.c  and set start threshold to -1,  your
program still run without calling snd_pcm_start

Calling snd_pcm_start when pcm state is running return error -77

> if the expected behavior is not to start stream automatically, try to
change -1 with the value obtained from snd_pcm_sw_params_get_boundary()
(after calling snd_pcm_sw_params_current()). Does it work better?

set start threshold to any value greater than buffer size need the
application  to explicitly call snd_pcm_start

Not sure what behaviour expected by pulseaudio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20141128/14f71c7d/attachment.html>


More information about the pulseaudio-discuss mailing list