I think I found a way to at least minimize this issue. From the
pulseaudio logs I found that for the AC3 plugin it isn't using the
default fragment settings from /etc/pulse/daemon.conf which are:

default-fragments = 8
default-fragment-size-msec = 10

Instead it adjusts to the nearest latency with a default fragment size
of 32 ms. So 8*10=80 ms. 32*3=96 ms is the nearest latency. It is using
a default fragment size of 32 ms no matter what size I set in
daemon.conf. This is what I am talking about:

I: [pulseaudio] alsa-sink.c: Using 3.0 fragments of size 18432 bytes (32.00ms), 
buffer size is 55296 bytes (96.00ms)
I: [pulseaudio] alsa-sink.c: Disabling rewind for device a52:0

I tried to lower the number of fragments and found that the frequency of
the audio drops increases. It might be too frequent actually. So
increasing the number of fragments should minimize the problem, right? I
can increase the number of fragments to the maximum hw buffer size
reported:

D: [pulseaudio] alsa-util.c: Maximum hw buffer size is 320 ms
D: [pulseaudio] alsa-util.c: Set buffer size first (to 3840 samples), period 
size second (to 480 samples).

So if I set 10 or more fragments it will use 10 fragments. However when
I set a too large buffer size (at leat 8 fragments) applications that
play through the alsa plugin for pulseaudio will cause noise. So now I
am using 5 fragments with good results so far. Here is what I have
written inside daemon.conf:

default-fragments = 5 # 8
default-fragment-size-msec = 32 # 10

This yields a buffer size of 160 ms. An increase of 64 ms from the
original 96 ms.

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to pulseaudio in Ubuntu.
https://bugs.launchpad.net/bugs/1188425

Title:
  Audio breaks up and pulseaudio eventually crashes with Alsa a52 (ac3)
  plugin (Ubuntu 13.04)

Status in “pulseaudio” package in Ubuntu:
  New

Bug description:
  I am encoding all audio in AC3 and sending it to my Logitech Z-5500
  speakers through the SPDIF out jack on my laptop. Audio works fine for
  a while until it breaks up randomly and pulseaudio eventually crashes.
  By looking to the pulseaudio logs one can see some buffer underruns. I
  also tested with the 3.9.4 mainline kernel though I am not sure this
  issue is driver related. The result is always the same! I have this in
  /usr/share/alsa/alsa.conf.d/a52.conf

  pcm.a52 {
        @args [CARD]
        @args.CARD {
                type string
        }
        type rate
        slave {
                pcm {
                        type a52
                        format S16_LE # S16_LE, S16_BE
                        channels 6 # 2, 4, 6
                        bitrate 640 # 192, 224, 256, 320, 384, 448, 512,  576, 
640
                        card $CARD
                }
                rate 48000 # 44100, 48000
        }
  }

  One other thing I tried was the dcaenc-2 alsa plugin from this web
  page http://aepatrakov.narod.ru/index/0-2 and this plugin appears to
  not have the same problem. The disadvantage of the dca plugin is that
  it needs a lot more processing power! So I would prefer the a52 plugin
  if it worked flawlessly.

  These are the answers to the first two questions:

  1)
  Ubuntu 13.04

  2)
  libasound2-plugins-extra:
    Installed: 1.0.25-2ubuntu3
    Candidate: 1.0.25-2ubuntu3
    Version table:
   *** 1.0.25-2ubuntu3 0
          500 http://pt.archive.ubuntu.com/ubuntu/ raring/universe amd64 
Packages
          100 /var/lib/dpkg/status

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1188425/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to