masmu / pulseaudio-dlna

A lightweight streaming server which brings DLNA / UPNP and Chromecast support to PulseAudio and Linux
GNU General Public License v3.0
1.25k stars 162 forks source link

Cannot start pa-dlna in docker container, on Slackware64 14.2 host #261

Closed cmeljakovo closed 7 years ago

cmeljakovo commented 7 years ago

Hi,

I have been trying to run pa-dlna in docker container on my Slack64 14.2, (Linux host 4.4.38 #2 SMP Sun Dec 11 16:18:36 CST 2016 x86_64 Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz GenuineIntel GNU/Linux ), with no success. Pulseaudio is running, dbus-protocol as well, on the host, but still getting some errors. Please review the attached debug log, your help will be much appreciated.

The following are the steps I followed:

bash-4.3$ xhost + access control disabled, clients can connect from any host

bash-4.3$ docker run -ti --net host -v /etc/passwd:/etc/passwd --user cmelo sesceu/pulseaudio-dlna --debug 12-28 14:27:07 pulseaudio_dlna.rules DEBUG Loaded rules: 12-28 14:27:07 pulseaudio_dlna.rules DEBUG DISABLE_DEVICE_STOP = <class 'pulseaudio_dlna.rules.DISABLE_DEVICE_STOP'> 12-28 14:27:07 pulseaudio_dlna.rules DEBUG FAKE_HTTP_CONTENT_LENGTH = <class 'pulseaudio_dlna.rules.FAKE_HTTP_CONTENT_LENGTH'> 12-28 14:27:07 pulseaudio_dlna.rules DEBUG REQUEST_TIMEOUT = <class 'pulseaudio_dlna.rules.REQUEST_TIMEOUT'> 12-28 14:27:07 pulseaudio_dlna.notification ERROR notify2 could not be initialized! Notifications will most likely not work. 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG Loaded encoders: 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.avconv.AVConvAacEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.avconv.AVConvFlacEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.avconv.AVConvL16Encoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.avconv.AVConvMp3Encoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.avconv.AVConvOggEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.avconv.AVConvOpusEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.avconv.AVConvWavEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.ffmpeg.FFMpegAacEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.ffmpeg.FFMpegFlacEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.ffmpeg.FFMpegL16Encoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.ffmpeg.FFMpegMp3Encoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.ffmpeg.FFMpegOggEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.ffmpeg.FFMpegOpusEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.ffmpeg.FFMpegWavEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.generic.FaacAacEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.generic.FlacFlacEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.generic.LameMp3Encoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.NullEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.generic.OggencOggEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.generic.OpusencOpusEncoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.generic.SoxL16Encoder'> 12-28 14:27:07 pulseaudio_dlna.encoder.avconv DEBUG <class 'pulseaudio_dlna.encoders.generic.SoxWavEncoder'> 12-28 14:27:07 pulseaudio_dlna.codecs DEBUG Loaded codecs: 12-28 14:27:07 pulseaudio_dlna.codecs DEBUG aac = <class 'pulseaudio_dlna.codecs.AacCodec'> 12-28 14:27:07 pulseaudio_dlna.codecs DEBUG flac = <class 'pulseaudio_dlna.codecs.FlacCodec'> 12-28 14:27:07 pulseaudio_dlna.codecs DEBUG l16 = <class 'pulseaudio_dlna.codecs.L16Codec'> 12-28 14:27:07 pulseaudio_dlna.codecs DEBUG mp3 = <class 'pulseaudio_dlna.codecs.Mp3Codec'> 12-28 14:27:07 pulseaudio_dlna.codecs DEBUG ogg = <class 'pulseaudio_dlna.codecs.OggCodec'> 12-28 14:27:07 pulseaudio_dlna.codecs DEBUG opus = <class 'pulseaudio_dlna.codecs.OpusCodec'> 12-28 14:27:07 pulseaudio_dlna.codecs DEBUG wav = <class 'pulseaudio_dlna.codecs.WavCodec'> 12-28 14:27:07 pulseaudio_dlna.application INFO Using version: 0.5.2 12-28 14:27:07 pulseaudio_dlna.application INFO Using localhost: 192.168.20.229:8080 12-28 14:27:07 pulseaudio_dlna.application INFO Encoder settings: 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO Codec settings: 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.application INFO 12-28 14:27:07 pulseaudio_dlna.discover DEBUG Binding socket to "" ... Process Process-3: Traceback (most recent call last): File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run self._target(*self._args, **self._kwargs) File "/usr/lib/python2.7/dist-packages/pulseaudio_dlna/pulseaudio.py", line 527, in run self._connect(signals) File "/usr/lib/python2.7/dist-packages/pulseaudio_dlna/pulseaudio.py", line 51, in _connect self.bus = self._get_bus() File "/usr/lib/python2.7/dist-packages/pulseaudio_dlna/pulseaudio.py", line 97, in _get_bus stdout=subprocess.PIPE).communicate() File "/usr/lib/python2.7/subprocess.py", line 390, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory Exception in thread zeroconf-ServiceBrowser__googlecast._tcp.local.: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib/python2.7/dist-packages/zeroconf.py", line 1164, in run self.zc.send(out) File "/usr/lib/python2.7/dist-packages/zeroconf.py", line 1853, in send bytes_sent = s.sendto(packet, 0, (addr, port)) error: [Errno 1] Operation not permitted

12-28 14:27:10 pulseaudio_dlna.discover DEBUG SSDPDiscover.search() quit ^CApplication is shutting down. bash-4.3$

bash-4.3$ pactl list modules short 0 module-device-restore 1 module-stream-restore 2 module-card-restore 3 module-augment-properties 4 module-switch-on-port-available 5 module-udev-detect 6 module-alsa-card device_id="0" name="pci-0000_00_1b.0" card_name="alsa_card.pci-0000_00_1b.0" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1" 7 module-bluetooth-policy 8 module-bluetooth-discover 9 module-bluez5-discover 10 module-esound-protocol-unix 11 module-native-protocol-unix 12 module-gconf 13 module-default-device-restore 14 module-rescue-streams 15 module-always-sink 16 module-intended-roles 17 module-suspend-on-idle 18 module-console-kit 19 module-position-event-sounds 20 module-role-cork 21 module-filter-heuristics 22 module-filter-apply 23 module-x11-publish display=:0 24 module-x11-cork-request display=:0 25 module-device-manager do_routing=1 26 module-x11-xsmp display=:0 session_manager=local/cmelo:@/tmp/.ICE-unix/1438,unix/cmelo:/tmp/.ICE-unix/1438 27 module-cli-protocol-unix 28 module-dbus-protocol bash-4.3$

bash-4.3$ pulseaudio --version pulseaudio 9.0-rebootstrapped

bash-4.3$ pactl list modules .... Module #28 Name: module-dbus-protocol Argument: Usage counter: n/a Properties: module.author = "Tanu Kaskinen" module.description = "D-Bus interface" module.version = "9.0-rebootstrapped" ....

EOF

cmeljakovo commented 7 years ago

After I disabled firewall on the host, I got further, seeing all DLNA renderers on my LAN. Still do not see the audio sink in pavucontrol. What else does it require to install on host?

Thank you.

masmu commented 7 years ago

Hey, you need a proper DBus connection to a running pulseaudio instance. You can try to start pulseaudio and DBus in the container or since DBus can be used over TCP create one to the running pulseaudio instance of the host system.

cmeljakovo commented 7 years ago

;-) Success!

Thank you for your help!

bash-4.3$ **docker run -ti --net host -v /etc/passwd:/etc/passwd --user cmelo --privileged sesceu/pulseaudio-dlna --debug**
12-28 16:30:31 pulseaudio_dlna.rules                          DEBUG    Loaded rules:
12-28 16:30:31 pulseaudio_dlna.rules                          DEBUG      DISABLE_DEVICE_STOP = <class 'pulseaudio_dlna.rules.DISABLE_DEVICE_STOP'>
12-28 16:30:31 pulseaudio_dlna.rules                          DEBUG      FAKE_HTTP_CONTENT_LENGTH = <class 'pulseaudio_dlna.rules.FAKE_HTTP_CONTENT_LENGTH'>
12-28 16:30:31 pulseaudio_dlna.rules                          DEBUG      REQUEST_TIMEOUT = <class 'pulseaudio_dlna.rules.REQUEST_TIMEOUT'>
12-28 16:30:31 pulseaudio_dlna.notification                   ERROR    notify2 could not be initialized! Notifications will most likely not work.
12-28 16:30:31 pulseaudio_dlna.encoder.avconv                 DEBUG    Loaded encoders:
....
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python2.7/dist-packages/pulseaudio_dlna/pulseaudio.py", line 527, in run
    self._connect(signals)
  File "/usr/lib/python2.7/dist-packages/pulseaudio_dlna/pulseaudio.py", line 51, in _connect
    self.bus = self._get_bus()
  File "/usr/lib/python2.7/dist-packages/pulseaudio_dlna/pulseaudio.py", line 97, in _get_bus
    stdout=subprocess.PIPE).communicate()
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
12-28 16:30:32 requests.packages.urllib3.connectionpool       DEBUG    Starting new HTTP connection (1): 192.168.20.238
12-28 16:30:32 requests.packages.urllib3.connectionpool       DEBUG    http://192.168.20.238:49152 "GET /description.xml HTTP/1.1" 200 3490
12-28 16:30:32 pulseaudio_dlna.plugins.upnp.renderer          DEBUG    Response from UPNP device (http://192.168.20.238:49152/description.xml)
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
......
</service>
</serviceList>
<presentationURL>/upmpd/presentation.html</presentationURL>
</device>
<URLBase>http://192.168.20.238:49152/</URLBase>
</root>

12-28 16:30:32 requests.packages.urllib3.connectionpool       DEBUG    Starting new HTTP connection (1): 192.168.20.238
12-28 16:30:32 requests.packages.urllib3.connectionpool       DEBUG    http://192.168.20.238:49152 "POST /ctl/ConnectionManager HTTP/1.1" 200 746
12-28 16:30:32 pulseaudio_dlna.plugins.upnp.renderer          DEBUG    Got the following mime types: "http-get:*:audio/dsd:*,http-get:*:audio/wav:*,http-get:*:audio/wave:*,http-get:*:audio/x-wav:*,http-get:*:audio/x-aiff:*,http-get:*:audio/mpeg:*,http-get:*:audio/x-mpeg:*,http-get:*:audio/mp1:*,http-get:*:audio/aac:*,http-get:*:audio/flac:*,http-get:*:audio/x-flac:*,http-get:*:audio/m4a:*,http-get:*:audio/mp4:*,http-get:*:audio/x-m4a:*,http-get:*:audio/vorbis:*,http-get:*:audio/ogg:*,http-get:*:audio/x-ogg:*,http-get:*:audio/x-scpls:*"
12-28 16:30:32 pulseaudio_dlna.plugins.upnp.renderer          DEBUG    sending GET_PROTOCOL_INFO to http://192.168.20.238:49152/ctl/ConnectionManager:
 - headers:
{u'SOAPAction': u'"urn:schemas-upnp-org:service:ConnectionManager:1#GetProtocolInfo"', u'Content-Type': u'text/xml; charset="utf-8"'}
 - data:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:GetProtocolInfo xmlns:u="urn:schemas-upnp-org:service:ConnectionManager:1">
        </u:GetProtocolInfo>
    </s:Body>
</s:Envelope>
 - result: 200
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:GetProtocolInfoResponse xmlns:u="urn:schemas-upnp-org:service:ConnectionManager:1">
<Source></Source>
<Sink>http-get:*:audio/dsd:*,http-get:*:audio/wav:*,http-get:*:audio/wave:*,http-get:*:audio/x-wav:*,http-get:*:audio/x-aiff:*,http-get:*:audio/mpeg:*,http-get:*:audio/x-mpeg:*,http-get:*:audio/mp1:*,http-get:*:audio/aac:*,http-get:*:audio/flac:*,http-get:*:audio/x-flac:*,http-get:*:audio/m4a:*,http-get:*:audio/mp4:*,http-get:*:audio/x-m4a:*,http-get:*:audio/vorbis:*,http-get:*:audio/ogg:*,http-get:*:audio/x-ogg:*,http-get:*:audio/x-scpls:*</Sink>
</u:GetProtocolInfoResponse>
....
12-28 16:30:40 pulseaudio_dlna.discover                       DEBUG    SSDPDiscover.search() quit
masmu commented 7 years ago

You are welcome. Is it completely running? Could you show me the docker recipe?

cmeljakovo commented 7 years ago

I will test it out thoroughly, to prove it works in KDE4 on my test machine next week and will post the recipe as well. The container I used is: https://hub.docker.com/r/sesceu/pulseaudio-dlna/

cmeljakovo commented 7 years ago

Happy New Year!

I've been trying to get it to work, but still no success in multiple distros. Can you shed some light, what mechanism/protocol is used when pa-dlna is creating the audio output sink in pavucontrol, please? Is it using dbus or http 4317 on pa..?

Thank you.

masmu commented 7 years ago

Please take a look at the pulseaudio.py ... it is using DBus to get all the information about sinks and streams and it uses CLI tools like pactl to create the sinks and for loading modules. And I guess this will be a problem since you are running the software in a container. I am seeing the following problems:

I know what you are thinking right now... Why are you using DBus to get all the information but not to also control pulseaudio? Because the DBus interface is just for quering information and you cannot control pulseaudio the last time I checked. There is just using the CLI tools or using the c-types bindings.

cmeljakovo commented 7 years ago

...I think your are absolutely correct. Let me check it out, try running it manually, to see the behaviour... I will post my finding sthen.

Thanks again.