All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaroslav Kysela <perex@perex.cz>
To: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Cc: "ext Aggarwal, Anuj" <anuj.aggarwal@ti.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	ext Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: Capture not working in MMAP mode with '-v'
Date: Mon, 9 Nov 2009 11:54:07 +0100 (CET)	[thread overview]
Message-ID: <alpine.LNX.2.00.0911091144270.12612@eeebox2.perex-int.cz> (raw)
In-Reply-To: <1257762766.11847.5.camel@eenurkka-desktop>

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@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

  reply	other threads:[~2009-11-09 10:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-09  7:56 Capture not working in MMAP mode with '-v' Aggarwal, Anuj
2009-11-09  7:58 ` Eero Nurkkala
2009-11-09  8:05   ` Aggarwal, Anuj
2009-11-09  8:12     ` Eero Nurkkala
2009-11-09 10:26       ` Mark Brown
2009-11-09 10:32         ` Eero Nurkkala
2009-11-09 10:54           ` Jaroslav Kysela [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-09-24  8:58 Aggarwal, Anuj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.0911091144270.12612@eeebox2.perex-int.cz \
    --to=perex@perex.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=anuj.aggarwal@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=ext-eero.nurkkala@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.