You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dshare plugin : If we use pcm instead of hw for aplay during suspend resume case always getting Failed and restarting stream is coming before playing back #479
==================================
Failure Case in case of PCM dshare plugin scenario
Suspended. Trying resume.
Failed. Restarting stream. // This creates confusion to user. Need help in fixing this error.
Done.
Success Case in case of Plug as plugin scenario even direct hw working fine.
Suspended. Trying resume.
Done.
======================================== @tiwai , @perexg
How to avoid device resumed before prepared, when a device has RESUME flag and is in SUSPENDED state?
So that in pcm3 dshare case error ( "Failed. Restarting stream") should not display before resume playback
I have added new prints in alsa-lib to debug the issue.
Actual with latest code with virtul pcm device (asound.conf) I'm getting following error message.
=============================================
$ aplay -D pcm3 Audio_WAV_48k_16bit_2ch.wav
Playing WAVE 'Audio_WAV_48k_16bit_2ch.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Suspended. Trying resume. Failed. Restarting stream. Done.
int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
{
unsigned int recoveries;
int state;
int ret;
int semerr;
semerr = snd_pcm_direct_semaphore_down(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
SNDERR("SEMDOWN FAILED with err %d", semerr);
return semerr;
}
state = snd_pcm_state(direct->spcm);
//// Second time it is enters here and return 0
if (state != SND_PCM_STATE_XRUN && state != SND_PCM_STATE_SUSPENDED) {
/* ignore... someone else already did recovery */
semerr = snd_pcm_direct_semaphore_up(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
SNDERR("SEMUP FAILED with err %d", semerr);
return semerr;
}
return 0;
}
recoveries = direct->shmptr->s.recoveries;
recoveries = (recoveries + 1) & RECOVERIES_MASK;
if (state == SND_PCM_STATE_SUSPENDED)
recoveries |= RECOVERIES_FLAG_SUSPENDED;
direct->shmptr->s.recoveries = recoveries;
/* some buggy drivers require the device resumed before prepared;
* when a device has RESUME flag and is in SUSPENDED state, resume
* here but immediately drop to bring it to a sane active state.
*/
//// First time it is enters here and success
if (state == SND_PCM_STATE_SUSPENDED &&
(direct->spcm->info & SND_PCM_INFO_RESUME)) {
snd_pcm_resume(direct->spcm);
snd_pcm_drop(direct->spcm);
snd_pcm_direct_timer_stop(direct);
snd_pcm_direct_clear_timer_queue(direct);
}
@tiwai , @perexg ,
dshare plugin : If we use pcm instead of hw for aplay during suspend resume case always getting Failed and restarting stream is coming before playing back properly, in aplay is getting EAGAIN error code from alsa-lib and in pcm_direct_resume always returning as failure and alsa-lib restarting stream to resume playback, how to avoid restarting stream.
Please suggest how to proceed.
Activity
arunkapale2 commentedon Oct 31, 2025
aplay -D hw:2,0 xyz.wav ==> Working case(hw:2,0 + Alsa library)
aplay -D pcm3 xyz.wav ==> not working case ( dshare case plugin case ( snd1_pcm_direct_check_xrun check) This additionally triggers SNDRV_PCM_TRIGGER_STOP )
aplay -D pcm1 xyz.wav ==> (Working case( Plug plugin +Alsa library))
==================================
Failure Case in case of PCM dshare plugin scenario
Suspended. Trying resume.
Failed. Restarting stream. // This creates confusion to user. Need help in fixing this error.
Done.
Success Case in case of Plug as plugin scenario even direct hw working fine.
Suspended. Trying resume.
Done.
========================================
@tiwai , @perexg
How to avoid device resumed before prepared, when a device has RESUME flag and is in SUSPENDED state?
So that in pcm3 dshare case error ( "Failed. Restarting stream") should not display before resume playback
perexg commentedon Oct 31, 2025
Could you show lines against the latest alsa-lib code? It's not clear where code is failing.
arunkapale2 commentedon Oct 31, 2025
@perexg,
I have added new prints in alsa-lib to debug the issue.
Actual with latest code with virtul pcm device (asound.conf) I'm getting following error message.
=============================================
$ aplay -D pcm3 Audio_WAV_48k_16bit_2ch.wav
Playing WAVE 'Audio_WAV_48k_16bit_2ch.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Suspended. Trying resume. Failed. Restarting stream. Done.
@perexg , Code sniffet is as below
alsa-lib/src/pcm/pcm_direct.c
Line 1150 in d62b1d5
int snd_pcm_direct_resume(snd_pcm_t *pcm)
{
snd_pcm_direct_t *dmix = pcm->private_data;
int err;
}
alsa-lib/src/pcm/pcm_direct.c
Line 578 in d62b1d5
int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
{
unsigned int recoveries;
int state;
int ret;
int semerr;
arunkapale2 commentedon Nov 1, 2025
@tiwai , @perexg ,
dshare plugin : If we use pcm instead of hw for aplay during suspend resume case always getting Failed and restarting stream is coming before playing back properly, in aplay is getting EAGAIN error code from alsa-lib and in pcm_direct_resume always returning as failure and alsa-lib restarting stream to resume playback, how to avoid restarting stream.
Please suggest how to proceed.
arunkapale2 commentedon Nov 25, 2025
@tiwai , @perexg , @broonie , @henrikau @sandsmark Anyone can help on the above issue.