Bug 93637 - pulseaudio core dumped when switch to profile output:iec958-ac3-surround-51 (alsa a52 plugin)
Summary: pulseaudio core dumped when switch to profile output:iec958-ac3-surround-51 (...
Status: NEW
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: alsa (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-07 23:22 UTC by Tom Yan
Modified: 2016-07-21 08:00 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
.asoundrc used to enable the ALSA a52 plugin (only alsa conf used) (102 bytes, text/plain)
2016-01-07 23:22 UTC, Tom Yan
Details
pulseaudio -vvv without the .asoundrc (142.30 KB, text/plain)
2016-01-07 23:22 UTC, Tom Yan
Details
pulseaudio -vvv with .asoundrc (155.34 KB, text/plain)
2016-01-07 23:24 UTC, Tom Yan
Details
pacmd list without .asoundrc (15.42 KB, text/plain)
2016-01-07 23:24 UTC, Tom Yan
Details
pacmd list with .asoundrc (15.84 KB, text/plain)
2016-01-07 23:26 UTC, Tom Yan
Details
full journalctl -b after core dumped (88.74 KB, text/plain)
2016-01-07 23:29 UTC, Tom Yan
Details
.asoundrc having the "type a52" pcm wrapped by a "type plug" pcm (174 bytes, text/plain)
2016-01-09 06:23 UTC, Tom Yan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Yan 2016-01-07 23:22:18 UTC
Created attachment 120880 [details]
.asoundrc used to enable the ALSA a52 plugin (only alsa conf used)

So I enabled the ALSA a52 plugin with the attached .asoundrc. PulseAudio starts fine and set up profile for it automatically. However, when I switch to the profile, Pulse throws an error and core dumped:
E: [alsa-sink-a52:0] alsa-sink.c: Assertion 'frames > 0' failed at modules/alsa/alsa-sink.c:627, function mmap_write(). Aborting.
Comment 1 Tom Yan 2016-01-07 23:22:53 UTC
Created attachment 120881 [details]
pulseaudio -vvv without the .asoundrc
Comment 2 Tom Yan 2016-01-07 23:24:08 UTC
Created attachment 120882 [details]
pulseaudio -vvv with .asoundrc

from starting pulse to set-card-profile and core dumped
Comment 3 Tom Yan 2016-01-07 23:24:59 UTC
Created attachment 120883 [details]
pacmd list without .asoundrc
Comment 4 Tom Yan 2016-01-07 23:26:20 UTC
Created attachment 120884 [details]
pacmd list with .asoundrc

[tom@localhost ~]$ diff before_list after_list 
421a422,424
> 		output:iec958-ac3-surround-51: Digital Surround 5.1 (IEC958/AC3) Output (priority 300, available: unknown)
> 		output:iec958-ac3-surround-51+input:analog-stereo: Digital Surround 5.1 (IEC958/AC3) Output + Analog Stereo Input (priority 360, available: unknown)
> 		output:iec958-ac3-surround-51+input:iec958-stereo: Digital Surround 5.1 (IEC958/AC3) Output + Digital Stereo (IEC958) Input (priority 355, available: unknown)
[tom@localhost ~]$
Comment 5 Tom Yan 2016-01-07 23:29:04 UTC
Created attachment 120885 [details]
full journalctl -b after core dumped

Jan 08 07:04:28 localhost rtkit-daemon[426]: Successfully made thread 425 of process 425 (/usr/bin/pulseaudio) owned by '1000' high priority at nice level -11.
Jan 08 07:04:28 localhost rtkit-daemon[426]: Supervising 1 threads of 1 processes of 1 users.
Jan 08 07:04:28 localhost rtkit-daemon[426]: Supervising 1 threads of 1 processes of 1 users.
Jan 08 07:04:28 localhost rtkit-daemon[426]: Successfully made thread 436 of process 425 (/usr/bin/pulseaudio) owned by '1000' RT at priority 5.
Jan 08 07:04:28 localhost rtkit-daemon[426]: Supervising 2 threads of 1 processes of 1 users.
Jan 08 07:04:28 localhost rtkit-daemon[426]: Supervising 2 threads of 1 processes of 1 users.
Jan 08 07:04:28 localhost rtkit-daemon[426]: Successfully made thread 437 of process 425 (/usr/bin/pulseaudio) owned by '1000' RT at priority 5.
Jan 08 07:04:28 localhost rtkit-daemon[426]: Supervising 3 threads of 1 processes of 1 users.
Jan 08 07:05:46 localhost rtkit-daemon[426]: Supervising 2 threads of 1 processes of 1 users.
Jan 08 07:05:46 localhost rtkit-daemon[426]: Successfully made thread 452 of process 425 (/usr/bin/pulseaudio) owned by '1000' RT at priority 5.
Jan 08 07:05:46 localhost rtkit-daemon[426]: Supervising 3 threads of 1 processes of 1 users.
Jan 08 07:05:46 localhost systemd-coredump[453]: Process 425 (pulseaudio) of user 1000 dumped core.
                                                 
                                                 Stack trace of thread 452:
                                                 #0  0x00007f61962945f8 raise (libc.so.6)
                                                 #1  0x00007f6196295a7a abort (libc.so.6)
                                                 #2  0x00007f6189366a4b n/a (libalsa-util.so)
                                                 #3  0x00007f61970d95f8 n/a (libpulsecommon-7.1.so)
                                                 #4  0x00007f61968104a4 start_thread (libpthread.so.0)
                                                 #5  0x00007f619634a13d __clone (libc.so.6)
                                                 
                                                 Stack trace of thread 425:
                                                 #0  0x00007f6196341251 ppoll (libc.so.6)
                                                 #1  0x00007f619732a61d pa_mainloop_poll (libpulse.so.0)
                                                 #2  0x00007f619732ac0e pa_mainloop_iterate (libpulse.so.0)
                                                 #3  0x00007f619732acc0 pa_mainloop_run (libpulse.so.0)
                                                 #4  0x0000000000406e4a main (pulseaudio)
                                                 #5  0x00007f6196281610 __libc_start_main (libc.so.6)
                                                 #6  0x00000000004077f9 _start (pulseaudio)
                                                 
                                                 Stack trace of thread 437:
                                                 #0  0x00007f6196341251 ppoll (libc.so.6)
                                                 #1  0x00007f619758d437 pa_rtpoll_run (libpulsecore-7.1.so)
                                                 #2  0x00007f618936cfba n/a (libalsa-util.so)
                                                 #3  0x00007f61970d95f8 n/a (libpulsecommon-7.1.so)
                                                 #4  0x00007f61968104a4 start_thread (libpthread.so.0)
                                                 #5  0x00007f619634a13d __clone (libc.so.6)

[tom@localhost ~]$ grep microcode journal 
Jan 08 07:03:35 localhost kernel: microcode: CPU0 microcode updated early to revision 0x1c, date = 2014-07-03
Jan 08 07:03:36 localhost kernel: microcode: CPU1 microcode updated early to revision 0x1c, date = 2014-07-03
Jan 08 07:03:36 localhost kernel: microcode: CPU2 microcode updated early to revision 0x1c, date = 2014-07-03
Jan 08 07:03:36 localhost kernel: microcode: CPU3 microcode updated early to revision 0x1c, date = 2014-07-03
Jan 08 07:03:36 localhost kernel: microcode: CPU0 sig=0x306c3, pf=0x2, revision=0x1c
Jan 08 07:03:36 localhost kernel: microcode: CPU1 sig=0x306c3, pf=0x2, revision=0x1c
Jan 08 07:03:36 localhost kernel: microcode: CPU2 sig=0x306c3, pf=0x2, revision=0x1c
Jan 08 07:03:36 localhost kernel: microcode: CPU3 sig=0x306c3, pf=0x2, revision=0x1c
Jan 08 07:03:36 localhost kernel: microcode: Microcode Update Driver: v2.00 <tigran@aivazian.fsnet.co.uk>, Peter Oruba
[tom@localhost ~]$
Comment 6 Tom Yan 2016-01-07 23:38:37 UTC
I am using the following in Arch Linux:
libpulse 7.1-3
pulseaudio 7.1-3
alsa-lib 1.1.0-1
alsa-plugins 1.1.0-1
alsa-utils 1.1.0-1
linux 4.3.3-2
glibc 2.22-3
Comment 7 Raymond 2016-01-08 10:19:22 UTC
http://git.alsa-project.org/?p=alsa-plugins.git;a=blob_plain;f=doc/a52.txt;hb=HEAD

Do pulseaudio misuse a52 plugin since it only supoort fixed card number
Comment 8 Tom Yan 2016-01-08 14:55:10 UTC
(In reply to Raymond from comment #7)
> http://git.alsa-project.org/?p=alsa-plugins.git;a=blob_plain;f=doc/a52.txt;
> hb=HEAD
> 
> Do pulseaudio misuse a52 plugin since it only supoort fixed card number

That has nothing to do with pulseaudio. These in the alsa conf allow a52 to route to different card:

    @args [ CARD ]
    @args.CARD {
        type string
    }
    card $CARD

The first line define the possible argument(s), the second define the type (if you use integer instead you can only use the index, otherwise you can use both the index or the name like "PCH" or so, the third will route to different card base on the argument (e.g. inserted by pulse). As the document has mentioned, the "card" parameter will look for iec958 (digital output port) automatically.
Comment 9 Raymond 2016-01-08 16:05:18 UTC
Seem use plug:a52:0 instead of a52:0

D: [pulseaudio] alsa-util.c: Trying a52:0 with SND_PCM_NO_AUTO_FORMAT ... 
D: [pulseaudio] alsa-util.c: Managed to open a52:0 
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_access() failed: Invalid argument 
D: [pulseaudio] alsa-util.c: PCM seems to support non-interleaved access, but PA doesn't. 
D: [pulseaudio] alsa-util.c: Trying a52:0 without SND_PCM_NO_AUTO_FORMAT ... 
D: [pulseaudio] alsa-util.c: Managed to open a52:0 
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_access() failed: Invalid argument D: [pulseaudio] alsa-util.c: PCM seems to support non-interleaved access, but PA doesn't. 
D: [pulseaudio] alsa-util.c: Trying plug:a52:0 with SND_PCM_NO_AUTO_FORMAT ... D: [pulseaudio] alsa-util.c: Managed to open plug:a52:0
Comment 10 Raymond 2016-01-09 03:26:32 UTC
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 plug:a52:0
D: [pulseaudio] alsa-sink.c: hwbuf_unused=0
D: [pulseaudio] alsa-sink.c: setting avail_min=1
I: [pulseaudio] alsa-sink.c: Disabling rewind_within_thread for device plug:a52:0
D: [pulseaudio] alsa-util.c: snd_pcm_dump():
D: [pulseaudio] alsa-util.c: Plug PCM: Copy conversion PCM
D: [pulseaudio] alsa-util.c: Its setup is:
D: [pulseaudio] alsa-util.c:   stream       : PLAYBACK
D: [pulseaudio] alsa-util.c:   access       : MMAP_INTERLEAVED
D: [pulseaudio] alsa-util.c:   format       : S16_LE
D: [pulseaudio] alsa-util.c:   subformat    : STD
D: [pulseaudio] alsa-util.c:   channels     : 6
D: [pulseaudio] alsa-util.c:   rate         : 48000
D: [pulseaudio] alsa-util.c:   exact rate   : 48000 (48000/1)
D: [pulseaudio] alsa-util.c:   msbits       : 16
D: [pulseaudio] alsa-util.c:   buffer_size  : 4608
D: [pulseaudio] alsa-util.c:   period_size  : 1536
D: [pulseaudio] alsa-util.c:   period_time  : 32000
D: [pulseaudio] alsa-util.c:   tstamp_mode  : ENABLE
D: [pulseaudio] alsa-util.c:   tstamp_type  : GETTIMEOFDAY
D: [pulseaudio] alsa-util.c:   period_step  : 1
D: [pulseaudio] alsa-util.c:   avail_min    : 1536
D: [pulseaudio] alsa-util.c:   period_event : 1
D: [pulseaudio] alsa-util.c:   start_threshold  : -1
D: [pulseaudio] alsa-util.c:   stop_threshold   : 5188146770730811392
D: [pulseaudio] alsa-util.c:   silence_threshold: 0
D: [pulseaudio] alsa-util.c:   silence_size : 0
D: [pulseaudio] alsa-util.c:   boundary     : 5188146770730811392
D: [pulseaudio] alsa-util.c: Slave: A52 Output Plugin
D: [pulseaudio] alsa-util.c: Its setup is:
D: [pulseaudio] alsa-util.c:   stream       : PLAYBACK
D: [pulseaudio] alsa-util.c:   access       : MMAP_NONINTERLEAVED
D: [pulseaudio] alsa-util.c:   format       : S16_LE
D: [pulseaudio] alsa-util.c:   subformat    : STD
D: [pulseaudio] alsa-util.c:   channels     : 6
D: [pulseaudio] alsa-util.c:   rate         : 48000
D: [pulseaudio] alsa-util.c:   exact rate   : 48000 (48000/1)
D: [pulseaudio] alsa-util.c:   msbits       : 16
D: [pulseaudio] alsa-util.c:   buffer_size  : 4608
D: [pulseaudio] alsa-util.c:   period_size  : 1536
D: [pulseaudio] alsa-util.c:   period_time  : 32000
D: [pulseaudio] alsa-util.c:   tstamp_mode  : ENABLE
D: [pulseaudio] alsa-util.c:   tstamp_type  : GETTIMEOFDAY
D: [pulseaudio] alsa-util.c:   period_step  : 1
D: [pulseaudio] alsa-util.c:   avail_min    : 1536
D: [pulseaudio] alsa-util.c:   period_event : 1
D: [pulseaudio] alsa-util.c:   start_threshold  : -1
D: [pulseaudio] alsa-util.c:   stop_threshold   : 5188146770730811392
D: [pulseaudio] alsa-util.c:   silence_threshold: 0
D: [pulseaudio] alsa-util.c:   silence_size : 0
D: [pulseaudio] alsa-util.c:   boundary     : 5188146770730811392
D: [alsa-sink-a52:0] alsa-sink.c: Thread starting up
D: [alsa-sink-a52:0] core-util.c: RealtimeKit worked.
I: [alsa-sink-a52:0] core-util.c: Successfully enabled SCHED_RR scheduling for thread, with priority 5.
I: [alsa-sink-a52:0] alsa-sink.c: Starting playback.
D: [pulseaudio] module-device-restore.c: Database contains no (or invalid) data for key: sink:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51:null
D: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51 becomes idle, timeout in 5 seconds.
I: [pulseaudio] module-always-sink.c: A new sink has been discovered. Unloading null-sink.
I: [pulseaudio] card.c: Changed profile of card 0 "alsa_card.pci-0000_07_04.0" to output:iec958-ac3-surround-51+input:analog-stereo
I: [pulseaudio] module-card-restore.c: Storing card profile for card alsa_card.pci-0000_07_04.0.
I: [pulseaudio] module.c: Unloading "module-null-sink" (index: #21).
D: [pulseaudio] module-rescue-streams.c: No sink inputs to move away.
D: [pulseaudio] module-rescue-streams.c: No source outputs to move away.
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove event.
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove event.
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove event.
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove event.
D: [null-sink] module-null-sink.c: Thread shutting down
I: [pulseaudio] sink.c: Freeing sink 1 "auto_null"
I: [pulseaudio] source.c: Freeing source 2 "auto_null.monitor"
I: [pulseaudio] module.c: Unloaded "module-null-sink" (index: #21).
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove event.
D: [pulseaudio] module-device-restore.c: Database contains no data for key: sink:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51
D: [pulseaudio] module-device-restore.c: Database contains no (or invalid) data for key: sink:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51:null
I: [pulseaudio] module-device-restore.c: Storing port for device sink:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51.
I: [pulseaudio] module-device-restore.c: Storing volume/mute for device+port sink:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51:null.
D: [pulseaudio] module-device-restore.c: Database contains no data for key: source:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51.monitor
D: [pulseaudio] module-device-restore.c: Database contains no (or invalid) data for key: source:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51.monitor:null
I: [pulseaudio] module-device-restore.c: Storing port for device source:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51.monitor.
I: [pulseaudio] module-device-restore.c: Storing volume/mute for device+port source:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51.monitor:null.
D: [pulseaudio] cli.c: CLI got EOF from user.
I: [pulseaudio] client.c: Freed 2 "UNIX socket client"
D: [pulseaudio] module-udev-detect.c: /dev/snd/controlC0 is accessible: yes
D: [pulseaudio] module-udev-detect.c: Resuming all sinks and sources of card alsa_card.pci-0000_07_04.0.
I: [alsa-sink-a52:0] ratelimit.c: 205 events suppressed
I: [alsa-sink-a52:0] alsa-sink.c: Underrun!
I: [alsa-sink-a52:0] alsa-sink.c: Underrun!
E: [alsa-sink-a52:0] alsa-sink.c: Assertion 'frames > 0' failed at modules/alsa/alsa-sink.c:627, function mmap_write(). Aborting.


do your pulseaudio client send any audio as the sink report underrun ?
Comment 11 Raymond 2016-01-09 03:31:57 UTC
do a52 plugin support non interleaved access mode ?

D: [pulseaudio] alsa-util.c: Slave: A52 Output Plugin
D: [pulseaudio] alsa-util.c: Its setup is:
D: [pulseaudio] alsa-util.c:   stream       : PLAYBACK
D: [pulseaudio] alsa-util.c:   access       : MMAP_NONINTERLEAVED
D: [pulseaudio] alsa-util.c:   format       : S16_LE
D: [pulseaudio] alsa-util.c:   subformat    : STD
D: [pulseaudio] alsa-util.c:   channels     : 6
D: [pulseaudio] alsa-util.c:   rate         : 48000
D: [pulseaudio] alsa-util.c:   exact rate   : 48000 (48000/1)
Comment 12 Raymond 2016-01-09 03:36:44 UTC
non interleaved access mode mean the period 1536 frames 6 channels data cannot be rewinded
Comment 13 Tom Yan 2016-01-09 06:23:17 UTC
Created attachment 120917 [details]
.asoundrc having the "type a52" pcm wrapped by a "type plug" pcm

Not sure what you mean, but I got the same error with this .asoundrc. Will post a full log with it if that's necessary.
Comment 14 Tom Yan 2016-01-09 06:24:13 UTC
(In reply to Raymond from comment #10)
> 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 plug:a52:0
> D: [pulseaudio] alsa-sink.c: hwbuf_unused=0
> D: [pulseaudio] alsa-sink.c: setting avail_min=1
> I: [pulseaudio] alsa-sink.c: Disabling rewind_within_thread for device
> plug:a52:0
> D: [pulseaudio] alsa-util.c: snd_pcm_dump():
> D: [pulseaudio] alsa-util.c: Plug PCM: Copy conversion PCM
> D: [pulseaudio] alsa-util.c: Its setup is:
> D: [pulseaudio] alsa-util.c:   stream       : PLAYBACK
> D: [pulseaudio] alsa-util.c:   access       : MMAP_INTERLEAVED
> D: [pulseaudio] alsa-util.c:   format       : S16_LE
> D: [pulseaudio] alsa-util.c:   subformat    : STD
> D: [pulseaudio] alsa-util.c:   channels     : 6
> D: [pulseaudio] alsa-util.c:   rate         : 48000
> D: [pulseaudio] alsa-util.c:   exact rate   : 48000 (48000/1)
> D: [pulseaudio] alsa-util.c:   msbits       : 16
> D: [pulseaudio] alsa-util.c:   buffer_size  : 4608
> D: [pulseaudio] alsa-util.c:   period_size  : 1536
> D: [pulseaudio] alsa-util.c:   period_time  : 32000
> D: [pulseaudio] alsa-util.c:   tstamp_mode  : ENABLE
> D: [pulseaudio] alsa-util.c:   tstamp_type  : GETTIMEOFDAY
> D: [pulseaudio] alsa-util.c:   period_step  : 1
> D: [pulseaudio] alsa-util.c:   avail_min    : 1536
> D: [pulseaudio] alsa-util.c:   period_event : 1
> D: [pulseaudio] alsa-util.c:   start_threshold  : -1
> D: [pulseaudio] alsa-util.c:   stop_threshold   : 5188146770730811392
> D: [pulseaudio] alsa-util.c:   silence_threshold: 0
> D: [pulseaudio] alsa-util.c:   silence_size : 0
> D: [pulseaudio] alsa-util.c:   boundary     : 5188146770730811392
> D: [pulseaudio] alsa-util.c: Slave: A52 Output Plugin
> D: [pulseaudio] alsa-util.c: Its setup is:
> D: [pulseaudio] alsa-util.c:   stream       : PLAYBACK
> D: [pulseaudio] alsa-util.c:   access       : MMAP_NONINTERLEAVED
> D: [pulseaudio] alsa-util.c:   format       : S16_LE
> D: [pulseaudio] alsa-util.c:   subformat    : STD
> D: [pulseaudio] alsa-util.c:   channels     : 6
> D: [pulseaudio] alsa-util.c:   rate         : 48000
> D: [pulseaudio] alsa-util.c:   exact rate   : 48000 (48000/1)
> D: [pulseaudio] alsa-util.c:   msbits       : 16
> D: [pulseaudio] alsa-util.c:   buffer_size  : 4608
> D: [pulseaudio] alsa-util.c:   period_size  : 1536
> D: [pulseaudio] alsa-util.c:   period_time  : 32000
> D: [pulseaudio] alsa-util.c:   tstamp_mode  : ENABLE
> D: [pulseaudio] alsa-util.c:   tstamp_type  : GETTIMEOFDAY
> D: [pulseaudio] alsa-util.c:   period_step  : 1
> D: [pulseaudio] alsa-util.c:   avail_min    : 1536
> D: [pulseaudio] alsa-util.c:   period_event : 1
> D: [pulseaudio] alsa-util.c:   start_threshold  : -1
> D: [pulseaudio] alsa-util.c:   stop_threshold   : 5188146770730811392
> D: [pulseaudio] alsa-util.c:   silence_threshold: 0
> D: [pulseaudio] alsa-util.c:   silence_size : 0
> D: [pulseaudio] alsa-util.c:   boundary     : 5188146770730811392
> D: [alsa-sink-a52:0] alsa-sink.c: Thread starting up
> D: [alsa-sink-a52:0] core-util.c: RealtimeKit worked.
> I: [alsa-sink-a52:0] core-util.c: Successfully enabled SCHED_RR scheduling
> for thread, with priority 5.
> I: [alsa-sink-a52:0] alsa-sink.c: Starting playback.
> D: [pulseaudio] module-device-restore.c: Database contains no (or invalid)
> data for key: sink:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51:null
> D: [pulseaudio] module-suspend-on-idle.c: Sink
> alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51 becomes idle, timeout in
> 5 seconds.
> I: [pulseaudio] module-always-sink.c: A new sink has been discovered.
> Unloading null-sink.
> I: [pulseaudio] card.c: Changed profile of card 0
> "alsa_card.pci-0000_07_04.0" to
> output:iec958-ac3-surround-51+input:analog-stereo
> I: [pulseaudio] module-card-restore.c: Storing card profile for card
> alsa_card.pci-0000_07_04.0.
> I: [pulseaudio] module.c: Unloading "module-null-sink" (index: #21).
> D: [pulseaudio] module-rescue-streams.c: No sink inputs to move away.
> D: [pulseaudio] module-rescue-streams.c: No source outputs to move away.
> D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove
> event.
> D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove
> event.
> D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove
> event.
> D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove
> event.
> D: [null-sink] module-null-sink.c: Thread shutting down
> I: [pulseaudio] sink.c: Freeing sink 1 "auto_null"
> I: [pulseaudio] source.c: Freeing source 2 "auto_null.monitor"
> I: [pulseaudio] module.c: Unloaded "module-null-sink" (index: #21).
> D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove
> event.
> D: [pulseaudio] module-device-restore.c: Database contains no data for key:
> sink:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51
> D: [pulseaudio] module-device-restore.c: Database contains no (or invalid)
> data for key: sink:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51:null
> I: [pulseaudio] module-device-restore.c: Storing port for device
> sink:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51.
> I: [pulseaudio] module-device-restore.c: Storing volume/mute for device+port
> sink:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51:null.
> D: [pulseaudio] module-device-restore.c: Database contains no data for key:
> source:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51.monitor
> D: [pulseaudio] module-device-restore.c: Database contains no (or invalid)
> data for key:
> source:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51.monitor:null
> I: [pulseaudio] module-device-restore.c: Storing port for device
> source:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51.monitor.
> I: [pulseaudio] module-device-restore.c: Storing volume/mute for device+port
> source:alsa_output.pci-0000_07_04.0.iec958-ac3-surround-51.monitor:null.
> D: [pulseaudio] cli.c: CLI got EOF from user.
> I: [pulseaudio] client.c: Freed 2 "UNIX socket client"
> D: [pulseaudio] module-udev-detect.c: /dev/snd/controlC0 is accessible: yes
> D: [pulseaudio] module-udev-detect.c: Resuming all sinks and sources of card
> alsa_card.pci-0000_07_04.0.
> I: [alsa-sink-a52:0] ratelimit.c: 205 events suppressed
> I: [alsa-sink-a52:0] alsa-sink.c: Underrun!
> I: [alsa-sink-a52:0] alsa-sink.c: Underrun!
> E: [alsa-sink-a52:0] alsa-sink.c: Assertion 'frames > 0' failed at
> modules/alsa/alsa-sink.c:627, function mmap_write(). Aborting.
> 
> 
> do your pulseaudio client send any audio as the sink report underrun ?

I don't having anything playing when I do these tests. I even avoided pavucontrol and use pacmd to switch profile instead.
Comment 15 Tom Yan 2016-01-09 06:31:40 UTC
(In reply to Raymond from comment #11)
> do a52 plugin support non interleaved access mode ?
> 
> D: [pulseaudio] alsa-util.c: Slave: A52 Output Plugin
> D: [pulseaudio] alsa-util.c: Its setup is:
> D: [pulseaudio] alsa-util.c:   stream       : PLAYBACK
> D: [pulseaudio] alsa-util.c:   access       : MMAP_NONINTERLEAVED
> D: [pulseaudio] alsa-util.c:   format       : S16_LE
> D: [pulseaudio] alsa-util.c:   subformat    : STD
> D: [pulseaudio] alsa-util.c:   channels     : 6
> D: [pulseaudio] alsa-util.c:   rate         : 48000
> D: [pulseaudio] alsa-util.c:   exact rate   : 48000 (48000/1)

[tom@localhost ~]$ aplay --dump-hw-param -M -D a52 st.wav 
Playing WAVE 'st.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Channels 6
HW Params of device "a52":
--------------------
ACCESS:  MMAP_NONINTERLEAVED RW_NONINTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 96
CHANNELS: 6
RATE: 48000
PERIOD_TIME: 32000
PERIOD_SIZE: 1536
PERIOD_BYTES: 18432
PERIODS: [2 21]
BUFFER_TIME: [64000 672000]
BUFFER_SIZE: [3072 32256]
BUFFER_BYTES: [36864 387072]
TICK_TIME: ALL
--------------------

Here you go, this is what reported by the a52 plugin. Although it reports "RW_NONINTERLEAVED" as well, but I can't run aplay without -M:

[tom@localhost ~]$ aplay --dump-hw-param -D a52 st.wav 
Playing WAVE 'st.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Channels 6
HW Params of device "a52":
--------------------
ACCESS:  MMAP_NONINTERLEAVED RW_NONINTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 96
CHANNELS: 6
RATE: 48000
PERIOD_TIME: 32000
PERIOD_SIZE: 1536
PERIOD_BYTES: 18432
PERIODS: [2 21]
BUFFER_TIME: [64000 672000]
BUFFER_SIZE: [3072 32256]
BUFFER_BYTES: [36864 387072]
TICK_TIME: ALL
--------------------
aplay: set_params:1228: Access type not available

These are captured with the original .asoundrc that does not use a "plug" wrapper btw.

And here is how my sound card goes when it's playing:

[tom@localhost ~]$ cat /proc/asound/card0/pcm1p/sub0/hw_params 
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 1536
buffer_size: 24576

FWIW, I see no significant delay in the opening and closing of device when I monitor this with `watch -n 0.1`.
Comment 16 Tom Yan 2016-01-09 06:39:06 UTC
Hmm seems like PulseAudio will use a "plug" pcm to wrap it anyway because a52 plugin does not support interleaved access but pulse does not support non-interleaved access, and pulse is aware of this.
Comment 17 Raymond 2016-01-09 07:22:02 UTC
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/alsa-sink.c

if (u->first) { 
      pa_log_info("Starting playback."); 
      snd_pcm_start(u->pcm_handle);


Pulseaudio call snd_pcm_start after printing "starting playback", a52 plugin need to compress certain amout of data for ac3 passthrough
Comment 18 Tom Yan 2016-01-09 09:06:54 UTC
(In reply to Raymond from comment #17)
> http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/alsa-
> sink.c
> 
> if (u->first) { 
>       pa_log_info("Starting playback."); 
>       snd_pcm_start(u->pcm_handle);
> 
> 
> Pulseaudio call snd_pcm_start after printing "starting playback", a52 plugin
> need to compress certain amout of data for ac3 passthrough

I don't really get what's your point here.

In any case, I just tried to switch profile and made sure that the setting is saved (so pulse will die as soon as I start it), and then start pulse through the socket by playing something with mpv instead of starting it manually "empty-handed". Pulse still died the same way.
Comment 19 quequotion 2016-01-09 17:10:29 UTC
He's referring to a a function in lines 1726-1738 of that code....

Maybe he means that the a52 should have a packet of compressed data ready at that moment?
Comment 20 Tom Yan 2016-01-09 17:42:08 UTC
Ready for whom? The physical device?

Just in case you guys aren't familiar with it, the a52 plugin is not like the pulse plugin, which routes from alsa to pulse. Instead, basically it substitute what pulse usually grab.

So usually it's like:
pulse -> iec958
and now it become:
pulse -> (plug:)a52 -> iec958

FWIW, this is mainly useful for S/PDIF only, where multichannel PCM is not possible.

So this:
pulse(down-mixed stereo / passthrough'd ac3) -> iec958
become this:
pulse(6-ch pcm) -> a52(encoded ac3) -> iec958
Comment 21 Raymond 2016-01-11 03:38:04 UTC
How did pulseaudio create headphone1 and headphone2 ports? 

ports: analog-output;output-speaker: 
Analog Output / Speaker (priority 9910, latency offset 0 usec, available: unknown) properties: 
analog-output;output-headphones-1: Analog Output / Headphones 1 (priority 9909, latency offset 0 usec, available: unknown) properties: 
analog-output;output-headphones-2: Analog Output / Headphones 2 (priority 9908, latency offset 0 usec, available: unknown) properties: active port: <analog-output;output-speaker>
Comment 22 Raymond 2016-01-11 03:45:44 UTC
aplay use buffer size as start threshold  but pulseaudio use -1

pcm start after three periods have written,  this mean you have at least written 20ms data 


http://git.alsa-project.org/?p=alsa-plugins.git;a=commitdiff;h=a0693150dfd428fdd4df474efdc6b5e26a41ba21;hp=3089c5826289f923c8bc63855da681cfdc7125d6
Comment 23 Raymond 2016-01-11 03:49:24 UTC
What are the values of hw_ptr and appl_ptr in proc/sound?
Comment 24 Tom Yan 2016-01-11 08:23:32 UTC
(In reply to Raymond from comment #21)
> How did pulseaudio create headphone1 and headphone2 ports? 
> 
> ports: analog-output;output-speaker: 
> Analog Output / Speaker (priority 9910, latency offset 0 usec, available:
> unknown) properties: 
> analog-output;output-headphones-1: Analog Output / Headphones 1 (priority
> 9909, latency offset 0 usec, available: unknown) properties: 
> analog-output;output-headphones-2: Analog Output / Headphones 2 (priority
> 9908, latency offset 0 usec, available: unknown) properties: active port:
> <analog-output;output-speaker>

I don't know how, but that's a feature of ASUS Xonar STX. There is an corresponding "Analog Output" switch in alsamixer, where the values are "Speakers", "Headphones" and "FP Headphones". (FP means Front Panel)
Comment 25 Tom Yan 2016-01-11 08:27:58 UTC
(In reply to Raymond from comment #22)
> aplay use buffer size as start threshold  but pulseaudio use -1
> 
> pcm start after three periods have written,  this mean you have at least
> written 20ms data 
> 
> 
> http://git.alsa-project.org/?p=alsa-plugins.git;a=commitdiff;
> h=a0693150dfd428fdd4df474efdc6b5e26a41ba21;
> hp=3089c5826289f923c8bc63855da681cfdc7125d6

Well the only thing I can tell is, if I `watch -n 0.1 /proc/asound/cardX/pcm1p/sub0/hw_params`, I can see that the card is being open shortly when I switch to the a52 surround profile. And if I specify my analog output in the "slavepcm" attribute of the a52 plugin, I can hear a "pop" sound when I do the switch.

So yeah, I guess it sent a bit to data to it when I switch.
Comment 26 Tom Yan 2016-01-11 08:28:54 UTC
(In reply to Raymond from comment #23)
> What are the values of hw_ptr and appl_ptr in proc/sound?

`find /proc/asound/ -name *ptr*` returns nothing. And there's no /proc/sound.
Comment 27 Raymond 2016-01-11 15:39:44 UTC
http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/conf/cards/aliases.conf;hb=HEAD

http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/conf/cards/CMI8788.conf;hb=HEAD

You can add pa_alsa_dump(PA_LOG_INFO, u->pcm_handle); when underrun occur 

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/alsa-sink.c 


if (!u->first && !u->after_rewind) 
     if (pa_log_ratelimit(PA_LOG_INFO)) 
          pa_log_info("Underrun!"); }
Comment 28 539 2016-07-21 02:47:06 UTC
Anyone got any progress/more info on that one? I got the same crash on 9 as well. Don't exactly know what's causing it. Is there some way I can find out if its maybe hardware-related?

If you need any more information then the original reporter already provided I'm happy to do that.
Comment 29 Raymond 2016-07-21 08:00:19 UTC
http://git.alsa-project.org/?p=alsa-plugins.git;a=blob;f=a52/pcm_a52.c;hb=HEAD

tatic int a52_set_hw_constraint(struct a52_ctx *rec)
{
	static unsigned int accesses[] = {
		SND_PCM_ACCESS_MMAP_INTERLEAVED,
		SND_PCM_ACCESS_MMAP_NONINTERLEAVED,
		SND_PCM_ACCESS_RW_INTERLEAVED,
		SND_PCM_ACCESS_RW_NONINTERLEAVED
	};
	static unsigned int accesses_planar[] = {
		SND_PCM_ACCESS_MMAP_NONINTERLEAVED,
		SND_PCM_ACCESS_RW_NONINTERLEAVED
	};
	unsigned int formats[] = { SND_PCM_FORMAT_S16 };
	int err;
	snd_pcm_uframes_t buffer_max;
	unsigned int period_bytes, max_periods;

	if (use_planar(rec))
		err = snd_pcm_ioplug_set_param_list(&rec->io,
						    SND_PCM_IOPLUG_HW_ACCESS,
						    ARRAY_SIZE(accesses_planar),
						    accesses_planar);
	else
		err = snd_pcm_ioplug_set_param_list(&rec->io,
						    SND_PCM_IOPLUG_HW_ACCESS,
						    ARRAY_SIZE(accesses),
						    accesses);
	if (err < 0)
		return err;


it seem use_planar(rec) is false as pulseaudio log 

D: [pulseaudio] alsa-util.c: Trying a52:0 with SND_PCM_NO_AUTO_FORMAT ...
D: [pulseaudio] alsa-util.c: Managed to open a52:0
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_access() failed: Invalid argument
D: [pulseaudio] alsa-util.c: PCM seems to support non-interleaved access, but PA doesn't.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.