Skip to contentSkip to conversation

pcm_hw: Remove unused fields in struct

PATCH In review David Henningsson 3 participants 5 messages May 30, 2013 – Jun 26, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 pcm_hw: Remove unused fields in struct

These fields are not used, and their name similarity to other fields are quite confusing when trying to debug alsa-lib.

---
 src/pcm/pcm_hw.c |    2 --
 1 file changed, 2 deletions(-)
src/pcm/pcm_hw.c +0 -2
index 0f3226d..196393d 100644
@@ -95,8 +95,6 @@ typedef struct {
 	volatile struct snd_pcm_mmap_status * mmap_status;
 	struct snd_pcm_mmap_control *mmap_control;
 	struct snd_pcm_sync_ptr *sync_ptr;
-	snd_pcm_uframes_t hw_ptr;
-	snd_pcm_uframes_t appl_ptr;
 	int period_event;
 	snd_timer_t *period_timer;
 	struct pollfd period_timer_pfd;
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 pcm_plugin: Fix return value of snd_pcm_rewind

In case the rewind did not rewind as much as expected, e g due to time delay between the latest avail update and the rewind, we must properly account for that in the plugin layer.

Otherwise, the plugin's appl ptr and the hw's appl ptr become unsynchronised, which is very bad, especially in mmap_shadow plugins, e g, this could cause the overlapping memcpy in the softvol plugin as seen here:
https://bugs.freedesktop.org/show_bug.cgi?id=64299

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

Btw, I was also considering always syncing the appl.ptr (for playback) with the slave in snd_pcm_plugin_avail_update, like we do for the hw.ptr. Do you think this would be a good idea?

src/pcm/pcm_plugin.c +2 -2
index 96218a8..17157e8 100644
@@ -219,9 +219,9 @@ static snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t
 		snd_atomic_write_end(&plugin->watom);
 		return sframes;
 	}
-	snd_pcm_mmap_appl_backward(pcm, (snd_pcm_uframes_t) frames);
+	snd_pcm_mmap_appl_backward(pcm, (snd_pcm_uframes_t) sframes);
 	snd_atomic_write_end(&plugin->watom);
-	return (snd_pcm_sframes_t) frames;
+	return (snd_pcm_sframes_t) sframes;
 }
 
 static snd_pcm_sframes_t snd_pcm_plugin_forwardable(snd_pcm_t *pcm)
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH alsa-lib 2/2] pcm_plugin: Fix return value of snd_pcm_rewind

Quoted 3 lines · David Henningsson

In case the rewind did not rewind as much as expected, e g due to time delay between the latest avail update and the rewind, we must properly account for that in the plugin layer.

Thank you very much for this fix.
I applied both patches to alsa-lib's repo.

Jaroslav

Signature · 3 lines
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
#3 lore raw

Re: [PATCH alsa-lib 2/2] pcm_plugin: Fix return value of snd_pcm_rewind

Quoted 7 lines · Jaroslav Kysela
Quoted 3 lines · David Henningsson

In case the rewind did not rewind as much as expected, e g due to time delay between the latest avail update and the rewind, we must properly account for that in the plugin layer.

Thank you very much for this fix.
I applied both patches to alsa-lib's repo.

Could we get a release with these patches? This does bite people a bit.

-- Arun

#4 lore raw

Re: [PATCH alsa-lib 2/2] pcm_plugin: Fix return value of snd_pcm_rewind

Quoted 10 lines · Arun Raghavan
Quoted 7 lines · Jaroslav Kysela
Quoted 3 lines · David Henningsson

In case the rewind did not rewind as much as expected, e g due to time delay between the latest avail update and the rewind, we must properly account for that in the plugin layer.

Thank you very much for this fix.
I applied both patches to alsa-lib's repo.

Could we get a release with these patches? This does bite people a bit.

I'll try to prepare alsa-lib 1.0.27.2 package in a few hours.

Jaroslav

Signature · 3 lines
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.