[vlc-devel] Re: RESOLVED: vlc sound playback breaks for USB between ALSA 1.0.9b and 1.0.10rc2

Matthew Hodgson matthew at mxtelecom.com
Thu Nov 3 13:30:25 CET 2005

Matthew Hodgson wrote:
> On Tue, 1 Nov 2005, Benjamin Pracht wrote:
>> On Mon, Oct 31, 2005, Matthew Hodgson wrote :
>>> Hi all,
>>> I spent a while wrestling with getting audio playback to work with my
>>> M-Audio Transit USB soundcard today - when playing back 44.1kHz or 48kHz
>>> sound with ALSA ~1.0.10rc2 I was getting:
>>> [00000838] main audio output debug: audio output is starving (35064),
>>> playing silence
>>> with --aout alsa and similar for --aout oss.  The timestamp diff in the
>>> starvation warning message is consistently ~40ms, and no sound was 
>>> output.
>>> VLC does however play back 22kHz files correctly (and at the right 
>>> pitch).
>> Well, mplayer sends 16 bits samples to the soundcard by default, AFAIK,
>> VLC 32 bits samples. That may explain the difference...
> Right - I can try to investigate that to find out how the 32-bit path 
> may have changed.
>> I cannot see any easy way to force VLC to send 16 bits samples to the
>> soundcard without patching the code...
>> On recent svn, using the --aout-rate 44001 option with alsa should have
>> this side effect, but the use of a non standard rate may cause other
>> issues. Could you please try however and see it that makes any change ?
> Of course.  This is using svn r13047 from a few days ago with alsa 
> 1.0.10rc2 (no explicit asound.conf).  Unfortunately the problem's still 
> present - here's the most relavent part of the log:

I've worked around this by increasing the size of ALSA_DEFAULT_PERIOD_SIZE 
(and thence ALSA_DEFAULT_BUFFER_SIZE) as used for 
snd_pcm_hw_params_set_buffer_size_near() and 
snd_pcm_hw_params_set_period_size_near() in audio_output/alsa.c.

The packet-size sending code for snd-usb-audio has been substantially 
reworked between ALSA 1.0.9 and 1.0.10, so it may be worth considering 
tweaking the buffersize in svn if other USB audio users are going to come up 
against this problem:

Index: alsa.c
--- alsa.c      (revision 13123)
+++ alsa.c      (working copy)
@@ -73,7 +73,7 @@
     To convert them to a number of bytes you have to multiply them by the
     number of channel(s) (eg. 2 for stereo) and the size of a sample (eg.
     2 for int16_t). */
-#define ALSA_DEFAULT_PERIOD_SIZE        1024
+#define ALSA_DEFAULT_PERIOD_SIZE        4096
  #define ALSA_SPDIF_PERIOD_SIZE          A52_FRAME_NB



Matthew Hodgson   matthew at mxtelecom.com   Tel: +44 845 6667778
                 Systems Analyst, MX Telecom Ltd.

This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html

More information about the vlc-devel mailing list