All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@aknet.ru>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: rate plugin issue
Date: Mon, 12 Nov 2007 22:25:17 +0300	[thread overview]
Message-ID: <4738A89D.9060601@aknet.ru> (raw)
In-Reply-To: <s5hwssnx58j.wl%tiwai@suse.de>

[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]

Hello.

Takashi Iwai wrote:
> I committed your patch now on HG tree, as it's likely OK from the
> possible breakage on other apps, too.
OK, first I have to apologize for
not providing a test-case - its still
in my todo if you need it. There are
still a few things unclear, like, for
example, how it fixes the portaudio,
if, as you say, such an apps are not
touching the code in question.

Anyway... as I said already, there are
few more problems that were hidden
before and are not any more. (I really
tried to warn you :)
For example, mpg123 will now consume
100% of CPU because of the nasty loop
in snd_pcm_write_areas()...
I am using something like the attached
patch, but maybe you can come up with
the better solution.
Quick summary: mpg123 sets avail_min=1,
so the loop spins without any rest.
Before, the value was "adjusted", so
it didn't spin that nasty way.

> Anyway, I swear that I'll never read any mails during my next
> vacation.  That was so exhausting to be dragged to a lengthy
> discussion for band-aiding a badly designed compoment... :)
But now, unfortunately, you won't get
away from that. :)
The hack used to cover more problems...


[-- Attachment #2: pcm.c.diff --]
[-- Type: text/x-patch, Size: 1084 bytes --]

--- pcm.c.old	2007-11-04 17:57:01.000000000 +0300
+++ pcm.c	2007-11-07 21:34:59.000000000 +0300
@@ -6465,19 +6465,35 @@
 			goto _end;
 		}
 		if ((state == SND_PCM_STATE_RUNNING &&
-		     (snd_pcm_uframes_t)avail < pcm->avail_min &&
 		     size > (snd_pcm_uframes_t)avail) ||
 		    (size >= pcm->xfer_align &&
 		     (snd_pcm_uframes_t)avail < pcm->xfer_align)) {
+			snd_pcm_sframes_t avail_min, orig_avail_min;
+			snd_pcm_sw_params_t params;
 
 			if (pcm->mode & SND_PCM_NONBLOCK) {
 				err = -EAGAIN;
 				goto _end;
 			}
 
+			avail_min = (size < pcm->period_size ?
+				size : pcm->period_size);
+			orig_avail_min = pcm->avail_min;
+			if (avail_min != pcm->avail_min) {
+				snd_pcm_sw_params_current(pcm, &params);
+				params.avail_min = avail_min;
+				snd_pcm_sw_params(pcm, &params);
+			}
+
 			err = snd_pcm_wait(pcm, -1);
 			if (err < 0)
 				break;
+
+			if (orig_avail_min != pcm->avail_min) {
+				params.avail_min = orig_avail_min;
+				snd_pcm_sw_params(pcm, &params);
+			}
+
 			goto _again;			
 		}
 		if ((snd_pcm_uframes_t) avail > pcm->xfer_align)

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

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

  reply	other threads:[~2007-11-12 19:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-12  8:01 rate plugin issue Takashi Iwai
2007-11-12 19:25 ` Stas Sergeev [this message]
2007-11-13  3:20   ` Takashi Iwai
2007-11-14 20:10     ` Stas Sergeev
2007-11-15  6:51       ` Takashi Iwai
2007-11-17 14:59         ` Stas Sergeev
2007-11-19 11:09           ` Takashi Iwai
2007-11-19 21:09             ` Stas Sergeev
2007-11-20  6:31               ` Takashi Iwai
2007-12-18 15:43                 ` Timur Tabi
2007-12-19 12:50                   ` Takashi Iwai
2007-11-13 11:04   ` Takashi Iwai

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=4738A89D.9060601@aknet.ru \
    --to=stsp@aknet.ru \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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.