Re: Capture not working in MMAP mode with '-v'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 9 Nov 2009, Eero Nurkkala wrote:

> So the patch:
>
> --- a/alsa-utils-1.0.21/aplay/aplay.c
> +++ b/alsa-utils-1.0.21/aplay/aplay-fix.c
> @@ -1104,7 +1104,8 @@ static void set_params(void)
> 	if (mmap_flag && verbose) {
> 		const snd_pcm_channel_area_t *areas;
> 		snd_pcm_uframes_t offset;
> -		int i;
> +		int i, chunk_prev = chunk_size;
> +		snd_pcm_avail_update(handle);
> 		err = snd_pcm_mmap_begin(handle, &areas, &offset, &chunk_size);
> 		if (err < 0) {
> 			error("snd_pcm_mmap_begin problem: %s", snd_strerror(err));
> @@ -1112,6 +1113,11 @@ static void set_params(void)
> 		}
> 		for (i = 0; i < hwparams.channels; i++)
> 			fprintf(stderr, "mmap_area[%i] = %p,%u,%u (%u)\n", i, areas[i].addr, areas[i].first, areas[i].step, snd_pcm_format_physical_width(hwparams.format));
> +
> +		/* Chunk size better be non-zero */
> +		if (!chunk_size)
> +                	chunk_size = chunk_prev;
> +
> 		/* not required, but for sure */
> 		snd_pcm_mmap_commit(handle, offset, 0);
> 	}

This patch removes wrong chunk_size initialization (commited to alsa-utils 
git repo now):

diff --git a/aplay/aplay.c b/aplay/aplay.c
index c7c82a1..f0fa969 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -1103,9 +1103,9 @@ static void set_params(void)
  	/* show mmap buffer arragment */
  	if (mmap_flag && verbose) {
  		const snd_pcm_channel_area_t *areas;
-		snd_pcm_uframes_t offset;
+		snd_pcm_uframes_t offset, size = chunk_size;
  		int i;
-		err = snd_pcm_mmap_begin(handle, &areas, &offset, &chunk_size);
+		err = snd_pcm_mmap_begin(handle, &areas, &offset, &size);
  		if (err < 0) {
  			error("snd_pcm_mmap_begin problem: %s", snd_strerror(err));
  			exit(EXIT_FAILURE);

It's not necessary to call snd_pcm_avail_update() and mangle chunk_size. 
The debug code wants to print the structure of mmaped areas only which are 
available all time.

Thanks for reporting (although only your last patch makes clear where the 
problem is for me).

 					Jaroslav

-----
Jaroslav Kysela <perex@xxxxxxxx>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux