[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
Wed Nov 26 22:42:00 PST 2014
> >
> > For those creative sound cards (e.g. emu10k1, ca0106) which use multi
> > plugin for surround playback
> >
> > It seem that set start_threshold to -1 has no effect on some devices
(e.g.
> > multi plugin) , the device seem automatically started and pulseaudio
does
> > not check pcm state when calling snd_pcm_start
> >
> > (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_START failed (-77)
> >
> > Does it mean bug of multi plugin or start_threshold.have no effect on
some
> > devices/plugin ?
>
> I'm not sure whether the value -1 is valid for start_threshold at
> all. Usually it's set between 1 and boundary.
>
>
If zero is not valid stop threshold, I suggest to return error when
application set start threshold to zero
Do all sound cards behave the same way when start threshold is set to 1 or
any value below period size / buffer size?
Most sound cards have FIFO and DMA brust size is usually more than 1
frame, this mean those data in second write won't used by the sound card
if the first write and start threshold is less than FIFO threshold or DMA
brust size
int snd_pcm_sw_params_set_start_threshold ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
snd_pcm_uframes_t val
)
Set start threshold inside a software configuration container.
Parameters:pcm PCM handle
params Software configuration container
val Start threshold in frames
Returns:
0 otherwise a negative error code
PCM is automatically started when playback frames available to PCM are >=
threshold or when requested capture frames are >= threshold
val is snd_pcm_uframes_t which is unsigned and pulseaudio set start
threshold to (snd_pcm_uframes_t) -1
if ((err = snd_pcm_sw_params_set_start_threshold(pcm, swparams,
(snd_pcm_uframes_t) -1)) < 0) {
pa_log_warn("Unable to set start threshold: %s\n",
pa_alsa_strerror(err));
return err;
}
> 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?
the error occur becauser snd_pcm_start() is called after the stream has
been started,
SNDRV_PCM_IOCTL_START failed (-77)
The error can be reproduced using snd-dummy to enumerate emu10k1
1) sudo insmod snd-dummy.ko index=2 model=emu10k1
2) add the following entry to /usr/share/alsa/cards/aliases.conf
Dummy cards.EMU10K1
aplay -L should list front, rear,clfe, ..surround40,. surround71 devices
of card 2
speaker-test -c4 -t wav -d -D surround40:2
3)restart pulseaudio in verbose mode and select card 2 Dummy in sound
preference and surround40 profile
The enumerated emu10k1 still support 44100Hz but does not have all controls
of emu10k1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20141127/32608623/attachment.html>
More information about the pulseaudio-discuss
mailing list