2

Hy, After Suspend - Resume Sound Applications still play, but there is no sound.

I need to issue (in a shell)

/usr/bin/pasuspender /bin/true

then sound is there again.

This command of course works too, but it breaks playback (Playback in Sound Applications has to be restarted), so I dont want this:

pulseaudio -k 

The two commands are described here:

https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting (See "No sound after resume from suspend")

So the problem is:

If I place the command "psasuspender..." into

/etc/systemd/system/resume-fix-pulseaudio@.service

after suspend, it does not work. So I setup a resume-script in

/etc/pm/sleep.d/

like this:

case "$1" in
    hibernate|suspend)
            # Stopping is not required
            ;;
    thaw|resume)
            /usr/bin/pasuspender /bin/true
            ;;
    *) exit $NA
            ;;
esac

This does not work neither, in /var/log/pm-suspend.log I then get:

Running hook /etc/pm/sleep.d/50alsa resume suspend:
Connection failure: Connection refused
pa_context_connect() failed: Invalid argument
/etc/pm/sleep.d/50alsa resume suspend: Returned exit code 1.

My Conclusion: In Systemd the script is not executed, dont know why. In /etc/pm/sleep.d the script is executed, but it is too early, it seems it is executed before pulse audio is up again. Because if I issue

/usr/bin/pasuspender /bin/true

after Resume in a Shell it always works.

So the question is:

Where to put /usr/bin/pasuspender /bin/true so it is executed very late in the Resume proces? It would be interesting too to know why I have to issue this command, couldnt find out what breaks playback @Suspend.

Ubuntu: 15.10 Soundcard: Xonar U7 USB

1

I am not answering your question as to how to solve the script issue; however I will venture an explanation as to why this is happening. The audio is a stream that is sent to the audio device, it is a one way communication; Awaiting no further response from the device, once the target is located and the stream is under way. As such, it is not easy to detect when the stream is broken, unlike any two way data flow, when it would be obvious that there is no longer any communication; thus after the stream is interrupted, by a suspend, the flow is halted and it looses its target. However it does not realise that this has happened due to the target location process happening only when the stream is being started; when the memory pointer is initialised.

The work around is most likely researching and reinitialising these memory locations.

Pulse Audio, it would seem, uses multiple buffers depending on the hardware, the hardware is of course the eventual target of the stream. Any one of these buffers, if they lose the pointer to the memory location, will stop playback. Here is an interesting little article:

http://voices.canonical.com/david.henningsson/2014/11/21/pulseaudio-buffers-and-protocol/

It is most likely that dma is happening during this process so as to free the stream from any heavy cpu dependency; of course depending on your hardware.

https://en.wikipedia.org/wiki/Direct_memory_access

Hope this helps in some way.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.