alsa-project / alsa-plugins

The Advanced Linux Sound Architecture (ALSA) - plugins
GNU Lesser General Public License v2.1
41 stars 28 forks source link

a52 plugin crashing pulseaudio #28

Closed quequotion closed 3 years ago

quequotion commented 3 years ago

Ever since f11e7a8994111f971bc881d4069f768472452f4f, the recent commit that brings the a52 plugin up to speed with ffmpeg's requirement for s32le format sampling, sending any audio to plug:a52 from any pulseaudio client crashes pulseaudio.

I posted this log earlier in #23, in which audio from mpv crashes pulseaudio.

I have tried other clients since and they all crash the same way.

This is with a default pulseaudio configuration, as shipped in Archlinux, and the following /etc/asound.conf:

# Alsa Resampler
 defaults.pcm.rate_converter "speexrate_best"

# Use PulseAudio by default
pcm.!default {
  type pulse
  fallback "sysdefault"
  hint {
    show on
    description "Default ALSA Output (currently PulseAudio Sound Server)"
  }
}

ctl.!default {
  type pulse
  fallback "sysdefault"
}

defaults.namehint.showall on
defaults.namehint.extended on

To enable the use of plug:a52 in pulseaudio without configuring it manually, I select the "Digital Surround 5.1 (IEC958/AC3) Output" profile in pavucontrol.

Pulseaudio, as far as I know, is agnostic of how ALSA plugins work internally. This leads me to think there is something not getting done right in the new patchset, even if it is tolerable in an ALSA-only setup.

tiwai commented 3 years ago

Please try to catch the crash with gdb and check the backtrace, identify which place it's triggered.

perexg commented 3 years ago

It seems that something is slow. PA with --realtime=false does not trigger this, so it's killed by the kernel. gdb does not help here.

quequotion commented 3 years ago

It seems that something is slow. PA with --realtime=false does not trigger this, so it's killed by the kernel. gdb does not help here.

Here's pulseaudio getting started by systemd and then killed, a couple of times, from journalctl -f:

Jun 17 23:21:22 Shiroko systemd[2338]: Listening on Sound System.
Jun 17 23:21:22 Shiroko io.elementary.n[11139]: gtk_widget_size_allocate(): attempt to allocate widget with width 292 and height -9
Jun 17 23:21:53 Shiroko systemd[2338]: Starting Sound Service...
Jun 17 23:21:53 Shiroko pulseaudio[135114]: Stale PID file, overwriting.
Jun 17 23:21:54 Shiroko rtkit-daemon[8609]: Supervising 0 threads of 0 processes of 0 users.
Jun 17 23:21:54 Shiroko rtkit-daemon[8609]: Successfully made thread 135117 of process 135114 owned by '1000' RT at priority 5.
Jun 17 23:21:54 Shiroko rtkit-daemon[8609]: Supervising 1 threads of 1 processes of 1 users.
Jun 17 23:21:54 Shiroko systemd[2338]: Started Sound Service.
Jun 17 23:21:54 Shiroko bluetoothd[626]: Endpoint registered: sender=:1.216 path=/MediaEndpoint/A2DPSink/sbc
Jun 17 23:21:54 Shiroko bluetoothd[626]: Endpoint registered: sender=:1.216 path=/MediaEndpoint/A2DPSource/sbc
Jun 17 23:22:18 Shiroko bluetoothd[626]: Endpoint unregistered: sender=:1.216 path=/MediaEndpoint/A2DPSink/sbc
Jun 17 23:22:18 Shiroko bluetoothd[626]: Endpoint unregistered: sender=:1.216 path=/MediaEndpoint/A2DPSource/sbc
Jun 17 23:22:18 Shiroko systemd[2338]: pulseaudio.service: Main process exited, code=killed, status=9/KILL
Jun 17 23:22:18 Shiroko systemd[2338]: pulseaudio.service: Failed with result 'signal'.
Jun 17 23:22:18 Shiroko systemd[2338]: pulseaudio.service: Consumed 11.158s CPU time.
Jun 17 23:22:18 Shiroko systemd[2338]: pulseaudio.service: Scheduled restart job, restart counter is at 1.
Jun 17 23:22:18 Shiroko systemd[2338]: Stopped Sound Service.
Jun 17 23:22:18 Shiroko systemd[2338]: pulseaudio.service: Consumed 11.158s CPU time.
Jun 17 23:22:18 Shiroko systemd[2338]: Starting Sound Service...
Jun 17 23:22:18 Shiroko pulseaudio[135182]: Stale PID file, overwriting.
Jun 17 23:22:18 Shiroko rtkit-daemon[8609]: Supervising 0 threads of 0 processes of 0 users.
Jun 17 23:22:18 Shiroko rtkit-daemon[8609]: Successfully made thread 135183 of process 135182 owned by '1000' RT at priority 5.
Jun 17 23:22:18 Shiroko rtkit-daemon[8609]: Supervising 1 threads of 1 processes of 1 users.
Jun 17 23:22:18 Shiroko systemd[2338]: Started Sound Service.
Jun 17 23:22:18 Shiroko bluetoothd[626]: Endpoint registered: sender=:1.218 path=/MediaEndpoint/A2DPSink/sbc
Jun 17 23:22:18 Shiroko bluetoothd[626]: Endpoint registered: sender=:1.218 path=/MediaEndpoint/A2DPSource/sbc
Jun 17 23:22:19 Shiroko bluetoothd[626]: Endpoint unregistered: sender=:1.218 path=/MediaEndpoint/A2DPSink/sbc
Jun 17 23:22:19 Shiroko bluetoothd[626]: Endpoint unregistered: sender=:1.218 path=/MediaEndpoint/A2DPSource/sbc
Jun 17 23:22:19 Shiroko systemd[2338]: pulseaudio.service: Main process exited, code=killed, status=9/KILL
Jun 17 23:22:19 Shiroko systemd[2338]: pulseaudio.service: Failed with result 'signal'.
Jun 17 23:22:19 Shiroko systemd[2338]: pulseaudio.service: Scheduled restart job, restart counter is at 2.
Jun 17 23:22:19 Shiroko systemd[2338]: Stopped Sound Service.
Jun 17 23:22:19 Shiroko systemd[2338]: Starting Sound Service...
Jun 17 23:22:19 Shiroko pulseaudio[135191]: Stale PID file, overwriting.
Jun 17 23:22:19 Shiroko rtkit-daemon[8609]: Supervising 0 threads of 0 processes of 1 users.
Jun 17 23:22:19 Shiroko rtkit-daemon[8609]: Successfully made thread 135192 of process 135191 owned by '1000' RT at priority 5.
Jun 17 23:22:19 Shiroko rtkit-daemon[8609]: Supervising 1 threads of 1 processes of 1 users.
Jun 17 23:22:19 Shiroko systemd[2338]: Started Sound Service.
Jun 17 23:22:19 Shiroko bluetoothd[626]: Endpoint registered: sender=:1.220 path=/MediaEndpoint/A2DPSink/sbc
Jun 17 23:22:19 Shiroko bluetoothd[626]: Endpoint registered: sender=:1.220 path=/MediaEndpoint/A2DPSource/sbc
Jun 17 23:22:19 Shiroko bluetoothd[626]: Endpoint unregistered: sender=:1.220 path=/MediaEndpoint/A2DPSink/sbc
Jun 17 23:22:19 Shiroko bluetoothd[626]: Endpoint unregistered: sender=:1.220 path=/MediaEndpoint/A2DPSource/sbc
Jun 17 23:22:19 Shiroko systemd[2338]: pulseaudio.service: Main process exited, code=killed, status=9/KILL
Jun 17 23:22:19 Shiroko systemd[2338]: pulseaudio.service: Failed with result 'signal'.
Jun 17 23:22:20 Shiroko systemd[2338]: pulseaudio.service: Scheduled restart job, restart counter is at 3.
Jun 17 23:22:20 Shiroko systemd[2338]: Stopped Sound Service.
Jun 17 23:22:20 Shiroko systemd[2338]: Starting Sound Service...
Jun 17 23:22:20 Shiroko pulseaudio[135199]: Stale PID file, overwriting.
Jun 17 23:22:20 Shiroko rtkit-daemon[8609]: Supervising 0 threads of 0 processes of 1 users.
Jun 17 23:22:20 Shiroko rtkit-daemon[8609]: Successfully made thread 135200 of process 135199 owned by '1000' RT at priority 5.
Jun 17 23:22:20 Shiroko rtkit-daemon[8609]: Supervising 1 threads of 1 processes of 1 users.
Jun 17 23:22:20 Shiroko systemd[2338]: Started Sound Service.
Jun 17 23:22:20 Shiroko bluetoothd[626]: Endpoint registered: sender=:1.222 path=/MediaEndpoint/A2DPSink/sbc
Jun 17 23:22:20 Shiroko bluetoothd[626]: Endpoint registered: sender=:1.222 path=/MediaEndpoint/A2DPSource/sbc

EDIT: I tried adding realtime-scheduling = no to /etc/pulse/daemon.conf.

Good news: pulseaudio does not immediately die when a client attempts to send audio through plug:a52

Bad news: CPU usage maxes out and no audio is produced. In fact, even pavumeter fails to register any audio.

quequotion commented 3 years ago

@manio helped out with reverting f11e7a8994111f971bc881d4069f768472452f4f (see diff).

This did allow pulseaudio to use the plugin again, but of course also brought back the choppy, chipmunk effect.

perexg commented 3 years ago

Try latest sources from repo, please.

tiwai commented 3 years ago

Also, try tsched=0 for PA. It's a blind shot, but this is always the first thing for a problem on PA.

manio commented 3 years ago

AFAICT your recent two commits probably fixed the problem :) I removed .asoundrc, enabled and started pulseaudio server and tested the audio on mpv and spotify. No problems noticed :) Before those two commits I have the same problem as @quequotion - the PA server was crashing.

Let's just wait for the @quequotion final test... :)

quequotion commented 3 years ago

Indeed, this has done the trick!

How do I buy all of you a round for the Zoom party we're having when this gets to release?