[pulseaudio-discuss] "Connection refused" on API pa_context_connect()

Steven Wawryk stevenw at acres.com.au
Fri Jul 14 09:59:15 UTC 2017


Hello,

I can't connect a pa_context to the PulseAudio server.  Can anyone help?

I've been trying to use the async API to connect to a source which has 
been setup by a PulseAudio CLI script.

When I use the script via the --file=<filename> argument to pulseaudio, 
then run my programs that use the API to connect to the source then 
everything works just fine.

When the CLI script is run on another machine as part of the start-up, 
then the program that uses the API (also on the same machine) always 
fails on the pa_context_connect() call, with "Connection refused" being 
the result of pa_strerror(pa_context_errno(context)).  The context was 
successfully created using a pa_mainloop_api * returned from a 
successfully created pa_mainloop.

I've attached the syslog extract for the session.  The PID for the 
pulseaudio process is 2733 (which is also what's in 
${XDG_RUNTIME_DIR}/pulse/pid) from "ps auxf". The program attempting to 
connect the context with the server exits because of the failure, but is 
restarted every 30 seconds (with progressively increasing PID).  All the 
relevant processes are owned by the same user.  When I ssh to the 
machine as the same user, I can connect with pactl.  "pactl list short 
sources" lists all the sources I expect to see, and "pactl info" gives 
the following output:

Server String: /run/user/1001/pulse/native
Library Protocol Version: 30
Server Protocol Version: 30
Is Local: yes
Client Index: 9
Tile Size: 65472
User Name: operator1
Host Name: mm2
Server Name: pulseaudio
Server Version: 8.0
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: audio_out
Default Source: alsa_output.pci-0000_02_00.1.hdmi-stereo.monitor
Cookie: 68bb:73b4

The platforms are ubuntu 16.04.  The call that fails is:

         result = pa_context_connect(context, nullptr, 
PA_CONTEXT_NOFLAGS, nullptr);

Cheers,

Steve Wawryk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: syslog-extract.txt.tar.gz
Type: application/gzip
Size: 52935 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20170714/727721de/attachment-0001.gz>


More information about the pulseaudio-discuss mailing list