Skip to contentSkip to conversation

plugin:dshare: wrong state reporting

PATCH Applied [email protected] 2 participants 2 messages Apr 4, 2017 – Apr 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 plugin:dshare: wrong state reporting

From: Andreas Pape <[email protected]>

If plugin dshare detects underrun, it reports this to the user via return value -EPIPE and setting dshare state to 'xrun' which is correct. But, if user after this wants to check the stream state, it is misleadingly reported as 'running' instead of 'xrun'.
With this behavior aplay e.g. will not do a proper underrun handling (restarting stream) but terminates streaming.
This is due to plugin dshare always returns state of the slave pcm, in pcm_ops->state() which is not correct.

src/pcm/pcm_dshare.c +1 -1
index 331f799..4c57fb4 100644
@@ -244,7 +244,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
 	default:
 		break;
 	}
-
+	status->state = snd_pcm_state(pcm);
 	status->trigger_tstamp = dshare->trigger_tstamp;
 	status->avail = snd_pcm_mmap_playback_avail(pcm);
 	status->avail_max = status->avail > dshare->avail_max ? status->avail : dshare->avail_max;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 12 lines · On Tue, 04 Apr 2017 08:29:52 +0200, [email protected] wrote:

From: Andreas Pape <[email protected]>

If plugin dshare detects underrun, it reports this to the user via return value -EPIPE and setting dshare state to 'xrun' which is correct. But, if user after this wants to check the stream state, it is misleadingly reported as 'running' instead of 'xrun'.
With this behavior aplay e.g. will not do a proper underrun handling (restarting stream) but terminates streaming.
This is due to plugin dshare always returns state of the slave pcm, in pcm_ops->state() which is not correct.

Quoted 2 lines

Applied now. Thanks.

Takashi

Quoted 17 lines
src/pcm/pcm_dshare.c +1 -1
index 331f799..4c57fb4 100644
@@ -244,7 +244,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
 	default:
 		break;
 	}
-
+	status->state = snd_pcm_state(pcm);
 	status->trigger_tstamp = dshare->trigger_tstamp;
 	status->avail = snd_pcm_mmap_playback_avail(pcm);
 	status->avail_max = status->avail > dshare->avail_max ? status->avail : dshare->avail_max;
Signature · 1 line
2.7.4