All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaroslav Kysela <perex@suse.cz>
To: Carlo Wood <carlo@alinoe.com>
Cc: "xvoice@yahoogroups.com" <xvoice@yahoogroups.com>,
	"kai.vehmanen@wakkanet.fi" <kai.vehmanen@wakkanet.fi>,
	"alsa-devel@lists.sourceforge.net"
	<alsa-devel@lists.sourceforge.net>
Subject: Re: Re: [xvoice] Hacking ViaVoice, part 4
Date: Sat, 12 Jul 2003 20:56:16 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0307122025230.1101-100000@pnote.perex-int.cz> (raw)
In-Reply-To: <20030712135025.GA6553@alinoe.com>

On Sat, 12 Jul 2003, Carlo Wood wrote:

> On Sat, Jul 12, 2003 at 02:08:34PM +0200, Carlo Wood wrote:
> > Hence, the problem is now reduced to the question:
> > Why is snd_pcm_update_hw_ptr_interrupt not called anymore
> > after we did run into an xrun?
> 
> I added a few more printk's and already I can guess
> what is the reason that the 'blackbox' (the rest)
> stops calling snd_pcm_update_hw_ptr_interrupt:
> 
> I thought it was said that an xrun should simply be ignored?

Yes, but at another level - in the OSS emulation code.

> What is the correct way to recover from this, to continue
> recording in this case, after the xrun?

Call read() or poll(POLLIN) again. I think that your problem might be that 
poll(POLLIN) does not trigger the input in the current ALSA code. Please, 
try this patch with ViaVoice (the patch is also in the ALSA CVS tree):

Index: pcm_oss.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/oss/pcm_oss.c,v
retrieving revision 1.38
diff -u -r1.38 pcm_oss.c
--- pcm_oss.c	4 Jul 2003 08:49:53 -0000	1.38
+++ pcm_oss.c	12 Jul 2003 18:54:30 -0000
@@ -1990,12 +1990,20 @@
 	}
 	if (csubstream != NULL) {
 		snd_pcm_runtime_t *runtime = csubstream->runtime;
+		enum sndrv_pcm_state ostate;
 		poll_wait(file, &runtime->sleep, wait);
 		snd_pcm_stream_lock_irq(csubstream);
-		if (runtime->status->state != SNDRV_PCM_STATE_RUNNING ||
+		if ((ostate = runtime->status->state) != SNDRV_PCM_STATE_RUNNING ||
 		    snd_pcm_oss_capture_ready(csubstream))
 			mask |= POLLIN | POLLRDNORM;
 		snd_pcm_stream_unlock_irq(csubstream);
+		if (ostate != SNDRV_PCM_STATE_RUNNING && runtime->oss.trigger) {
+			snd_pcm_oss_file_t ofile;
+			memset(&ofile, 0, sizeof(ofile));
+			ofile.streams[SNDRV_PCM_STREAM_CAPTURE] = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
+			runtime->oss.trigger = 0;
+			snd_pcm_oss_set_trigger(&ofile, PCM_ENABLE_INPUT);
+		}
 	}
 
 	return mask;


						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1

  reply	other threads:[~2003-07-12 18:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20030712120834.GA5378@alinoe.com>
2003-07-12 13:50 ` [xvoice] Hacking ViaVoice, part 4 Carlo Wood
2003-07-12 18:56   ` Jaroslav Kysela [this message]
2003-07-12 23:05     ` Carlo Wood
2003-07-12 23:10       ` Carlo Wood

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=Pine.LNX.4.44.0307122025230.1101-100000@pnote.perex-int.cz \
    --to=perex@suse.cz \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=carlo@alinoe.com \
    --cc=kai.vehmanen@wakkanet.fi \
    --cc=xvoice@yahoogroups.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.