All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Nikolov <nickysn@gmail.com>
To: alsa-devel@alsa-project.org
Subject: ALSA PulseAudio plugin: snd_pcm_rewindable() returns >0, but snd_pcm_rewind() is broken
Date: Mon, 24 Oct 2011 16:28:10 +0300	[thread overview]
Message-ID: <4EA567EA.1020603@gmail.com> (raw)

Hi all,

I submitted a bug report for this here:
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=5464
I got a comment, which said I should post this on the mailing list, so 
I'm doing this now:

I'm writing a program that tries to use the snd_pcm_rewind() function if 
it's available and I'm having serious trouble with the alsa-pulseaudio 
plugin.

I'm using the max buffer size, which is 1048576 frames (4MB buffer, 
16-bit stereo). The buffer is almost full when I try to rewind. I first 
call snd_pcm_rewindable() and it returns a greater than zero value. Then 
I call snd_pcm_rewind() with this value and it returns success, i.e. a 
positive value of frames actually rewound. I then call snd_pcm_writei 
with the number of frames rewound and I get a weird pause (several 
seconds) in the audio on the next poll. Audio then continues from the 
middle; the beginning of the audio that was rewritten immediately after 
rewind() has been dropped. Also, pulseaudio reports several times the 
following error:

protocol-native.c: Failed to push data into queue

After looking at the alsa-lib and alsa-plugins sources, it seems that 
snd_pcm_rewind() for ioplug devices only updates an internal pointer and 
doesn't notify pulseaudio, so on the next write we just try to push too 
much data to the pulseaudio stream. After googling a bit, I found this 
email from 17 Feb 2010 from Lennart Poettering, which says that 
snd_pcm_rewind() is broken for the alsa-pulseaudio plugin.

http://ns.spinics.net/lists/alsa-devel/msg31536.html


Also, this mail:

http://lists.freedesktop.org/archives/pulseaudio-bugs/2010-July/004051.html

says that snd_pcm_rewindable() should always return 0 frames on ioplug 
devices, and if that's not the case, then it's a bug in alsa.

So, if I'm getting this right, either snd_pcm_rewindable() should be 
fixed to return 0, or snd_pcm_rewind() should be fixed to work properly 
with the alsa-pulseaudio plugin.

Thanks,
Nikolay

             reply	other threads:[~2011-10-24 13:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-24 13:28 Nikolay Nikolov [this message]
2011-10-24 15:34 ` ALSA PulseAudio plugin: snd_pcm_rewindable() returns >0, but snd_pcm_rewind() is broken Pierre-Louis Bossart
     [not found] ` <4ea5858a.4a2acc0a.3bb5.5b58SMTPIN_ADDED@mx.google.com>
2011-10-24 16:55   ` Nikolay Nikolov
2011-10-24 23:00     ` Raymond Yau

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=4EA567EA.1020603@gmail.com \
    --to=nickysn@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    /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.