Skip to contentSkip to conversation

pcm: fix return value of snd_pcm_share_slave_avail

PATCH Applied Alexander E. Patrakov 2 participants 2 messages Sep 1, 2014 – Sep 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pcm: fix return value of snd_pcm_share_slave_avail

The return value was wrong for playback if slave->hw_ptr was near the boundary and *pcm->appl.ptr was near zero. The wrong result was greater than the boundary.

---
 src/pcm/pcm_share.c | 2 ++
 1 file changed, 2 insertions(+)

Only compile-tested, as I don't know how to setup the "share" pcm.

src/pcm/pcm_share.c +2 -0
index 9770544..c301c7a 100644
@@ -128,6 +128,8 @@ static snd_pcm_uframes_t snd_pcm_share_slave_avail(snd_pcm_share_slave_t *slave)
 		avail += pcm->buffer_size;
 	if (avail < 0)
 		avail += pcm->boundary;
+	else if ((snd_pcm_uframes_t) avail >= pcm->boundary)
+		avail -= pcm->boundary;
 	return avail;
 }
 
Signature · 1 line
2.1.0
Applied
#1 lore raw

At Tue, 2 Sep 2014 01:29:36 +0600,

Quoted 6 lines · Alexander E. Patrakov

The return value was wrong for playback if slave->hw_ptr was near the boundary and *pcm->appl.ptr was near zero. The wrong result was greater than the boundary.

Applied, thanks.

Takashi

Quoted 22 lines
---
 src/pcm/pcm_share.c | 2 ++
 1 file changed, 2 insertions(+)

Only compile-tested, as I don't know how to setup the "share" pcm.

src/pcm/pcm_share.c +2 -0
index 9770544..c301c7a 100644
@@ -128,6 +128,8 @@ static snd_pcm_uframes_t snd_pcm_share_slave_avail(snd_pcm_share_slave_t *slave)
 		avail += pcm->buffer_size;
 	if (avail < 0)
 		avail += pcm->boundary;
+	else if ((snd_pcm_uframes_t) avail >= pcm->boundary)
+		avail -= pcm->boundary;
 	return avail;
 }
 
Signature · 1 line
2.1.0