[alsa-devel] dmix/dshare: discrepancy between snd_pcm_{status, state, delay}

Cheng Sun chengsun9 at gmail.com
Sat Mar 18 13:18:55 CET 2017


Hi all,

I've been tracking down the cause of an indefinite hang in PortAudio
whenever an xrun occurs, and bisected the issue to the following.

After commits faf53c19 (dshare) and 38a2d2ed (dmix), the semantics of
snd_pcm_state and snd_pcm_delay are no longer the same as a query to
snd_pcm_status, and a subsequent snd_pcm_status_get_*.

Note that these two commits remove the lines that set the state field
in the snd_pcm_status_t:

-       status->state = snd_pcm_state(dshare->spcm);

This causes the behaviour where, when a dmix's slave suffers an xrun,
and the dmix's status is queried, snd_pcm_status_get_state returns
RUNNING, and yet snd_pcm_state returns XRUN.

The reason why I am not attaching a patch right now is because I am
confused as to the commit message in faf53c19, which explicitly
states:

    Note: snd_pcm_dshare_delay() is not updated.

Which leads me to think that this change in semantics was perhaps
deliberate (if not documented anywhere). However I'm not sure what the
rationale is, so I'm not clear on the right way to go about fixing it.

If anyone could shed any further light into this, I'd be very grateful.

Cheers,
Cheng


More information about the Alsa-devel mailing list