Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sangean DDR-63+ ValueError UPNP Renderer #74

Closed
LGro opened this issue Aug 24, 2015 · 11 comments
Closed

Sangean DDR-63+ ValueError UPNP Renderer #74

LGro opened this issue Aug 24, 2015 · 11 comments

Comments

@LGro
Copy link

LGro commented Aug 24, 2015

When I'm running pulseaudio-dlna and have my Sangean set to network player mode I encounter the following error twice:

Exception happened during processing of request from ('192.168.178.32', 52591)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 599, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 655, in init
self.handle()
File "/usr/lib/python2.7/site-packages/pulseaudio_dlna/listener.py", line 36, in handle
self.server.renderers_holder.process_notify_request(packet)
File "/usr/lib/python2.7/site-packages/pulseaudio_dlna/renderers.py", line 119, in process_notify_request
self._add_renderer_with_filter_check(device_id, device)
File "/usr/lib/python2.7/site-packages/pulseaudio_dlna/renderers.py", line 67, in _add_renderer_with_filter_check
self._add_renderer(device_id, device)
File "/usr/lib/python2.7/site-packages/pulseaudio_dlna/renderers.py", line 73, in _add_renderer
device.activate()
File "/usr/lib/python2.7/site-packages/pulseaudio_dlna/plugins/upnp/renderer.py", line 156, in activate
self.get_protocol_info()
File "/usr/lib/python2.7/site-packages/pulseaudio_dlna/plugins/upnp/renderer.py", line 250, in get_protocol_info
http_get, w1, mime_type, w2 = sink.strip().split(':')
ValueError: need more than 1 value to unpack

System info:

Linux version 3.18.20-1-MANJARO (builduser@manjaro) (gcc version 5.2.0 (GCC) )
pulseaudio-dlna 0.4.3-1 from AUR

@masmu
Copy link
Owner

masmu commented Aug 24, 2015

This bug is fixed in the bug/mimetype-lookup branch. Beside a workaround you can get more information about it here.

The fix will be included in the next release.

@LGro
Copy link
Author

LGro commented Aug 24, 2015

I tried building the bug/mimetype-lookup branch but couldn't get it to work because of another error:

08-24 14:28:29 pulseaudio_dlna.pulseaudio INFO Instructing the device "DDR-63+ XXXX (DLNA)" to play ...
Traceback (most recent call last):
File "/workspace/pulseaudio-dlna/pulseaudio_dlna/pulseaudio.py", line 572, in _handle_sink_update
if bridge.device.play() == 200:
File "
/workspace/pulseaudio-dlna/pulseaudio_dlna/plugins/upnp/renderer.py", line 341, in play
if UpnpMediaRenderer.register(self, stream_url) == 200:
File "~/workspace/pulseaudio-dlna/pulseaudio_dlna/plugins/upnp/renderer.py", line 189, in register
url = self.service_transport.control_url
AttributeError: 'NoneType' object has no attribute 'control_url'

EDIT: Maybe my device doesn't work with this streaming approach at all?!

@masmu
Copy link
Owner

masmu commented Aug 24, 2015

Ok, could you provide a full debug.log?

bin/pulseaudio-dlna --debug 2>&1 | tee -a debug.log will create a debug.log in the current directory.

@LGro
Copy link
Author

LGro commented Aug 24, 2015

08-24 14:27:03 pulseaudio_dlna.application                    INFO     Using localhost: XXXX:8080
08-24 14:27:03 pulseaudio_dlna.application                    INFO     Loaded encoders:
08-24 14:27:03 pulseaudio_dlna.application                    INFO     <LameEncoder bit-rate="192" state="True" enabled="True" mime-types="audio/mpeg,audio/mp3">
08-24 14:27:03 pulseaudio_dlna.application                    INFO     <WavEncoder bit-rate="None" state="False" enabled="True" mime-types="audio/wav,audio/x-wav">
08-24 14:27:03 pulseaudio_dlna.application                    INFO     <AacEncoder bit-rate="192" state="True" enabled="True" mime-types="audio/aac,audio/x-aac">
08-24 14:27:03 pulseaudio_dlna.application                    INFO     <FlacEncoder bit-rate="None" state="True" enabled="True" mime-types="audio/flac,audio/x-flac">
08-24 14:27:03 pulseaudio_dlna.application                    INFO     <OggEncoder bit-rate="192" state="False" enabled="True" mime-types="audio/ogg,audio/x-ogg,application/ogg">
08-24 14:27:03 pulseaudio_dlna.application                    INFO     <OpusEncoder bit-rate="192" state="False" enabled="True" mime-types="audio/opus,audio/x-opus">
08-24 14:27:08 pulseaudio_dlna.listener                       INFO     Discovery complete.
08-24 14:28:18 pulseaudio_dlna.application                    INFO     Using localhost: XXXX:8080
08-24 14:28:18 pulseaudio_dlna.application                    INFO     Loaded encoders:
08-24 14:28:18 pulseaudio_dlna.application                    INFO     <LameEncoder bit-rate="192" state="True" enabled="True" mime-types="audio/mpeg,audio/mp3">
08-24 14:28:18 pulseaudio_dlna.application                    INFO     <WavEncoder bit-rate="None" state="False" enabled="True" mime-types="audio/wav,audio/x-wav">
08-24 14:28:18 pulseaudio_dlna.application                    INFO     <AacEncoder bit-rate="192" state="True" enabled="True" mime-types="audio/aac,audio/x-aac">
08-24 14:28:18 pulseaudio_dlna.application                    INFO     <FlacEncoder bit-rate="None" state="True" enabled="True" mime-types="audio/flac,audio/x-flac">
08-24 14:28:18 pulseaudio_dlna.application                    INFO     <OggEncoder bit-rate="192" state="False" enabled="True" mime-types="audio/ogg,audio/x-ogg,application/ogg">
08-24 14:28:18 pulseaudio_dlna.application                    INFO     <OpusEncoder bit-rate="192" state="False" enabled="True" mime-types="audio/opus,audio/x-opus">
08-24 14:28:18 requests.packages.urllib3.connectionpool       INFO     Starting new HTTP connection (1): XXXX
08-24 14:28:18 requests.packages.urllib3.connectionpool       DEBUG    "GET / HTTP/1.1" 200 None
08-24 14:28:18 pulseaudio_dlna.plugins.upnp.renderer          DEBUG    Response from UPNP device (http://XXXX:57109/)
<?xml version="1.0" encoding="utf-8"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
   <specVersion>
      <major>1</major>
      <minor>0</minor>
   </specVersion>
   <device>
      <deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
      <friendlyName>DDR-63+ XXXX</friendlyName>
      <manufacturer>SANGEAN ELECTRONICS INC.</manufacturer>
      <manufacturerURL>http://www.sangean.com.tw</manufacturerURL>
      <modelDescription>ir-mmi-XXXX</modelDescription>
      <modelName>DDR-63+</modelName>
      <modelNumber>DDR-63+</modelNumber>
      <modelURL>http://www.sangean.com.tw</modelURL>
      <serialNumber>XXXX</serialNumber>
      <UDN>uuid:XXXX</UDN>
      <iconList>
         <icon>
            <mimetype>image/png</mimetype>
            <width>48</width>
            <height>48</height>
            <depth>32</depth>
            <url>/icon.png</url>
         </icon>
         <icon>
            <mimetype>image/jpg</mimetype>
            <width>48</width>
            <height>48</height>
            <depth>32</depth>
            <url>/icon.jpg</url>
         </icon>
         <icon>
            <mimetype>image/png</mimetype>
            <width>120</width>
            <height>120</height>
            <depth>32</depth>
            <url>/icon2.png</url>
         </icon>
         <icon>
            <mimetype>image/jpg</mimetype>
            <width>120</width>
            <height>120</height>
            <depth>32</depth>
            <url>/icon2.jpg</url>
         </icon>
      </iconList>
  <serviceList><service><serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType><serviceId>urn:upnp-org:serviceId:ConnectionManager_XXXX</serviceId><SCPDURL>ConnectionManager/scpd.xml</SCPDURL><controlURL>ConnectionManager/control</controlURL><eventSubURL>ConnectionManager/event</eventSubURL></service><service><serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType><serviceId>urn:upnp-org:serviceId:RenderingControl_XXXX</serviceId><SCPDURL>RenderingControl/scpd.xml</SCPDURL><controlURL>RenderingControl/control</controlURL><eventSubURL>RenderingControl/event</eventSubURL></service></serviceList></device></root>
08-24 14:28:18 requests.packages.urllib3.connectionpool       INFO     Starting new HTTP connection (1): XXXX
08-24 14:28:18 requests.packages.urllib3.connectionpool       DEBUG    "POST /ConnectionManager/control HTTP/1.1" 200 None
08-24 14:28:18 pulseaudio_dlna.plugins.upnp.renderer          DEBUG    Got the following mime types: "http-get:*:audio/mpeg:*,http-get:*:audio/mp4:*,http-get:*:audio/m4a:*,http-get:*:audio/x-m4a:*,http-get:*:audio/m4b:*,http-get:*:audio/x-m4b:*,http-get:*:audio/x-aac:*,http-get:*:audio/wav:*,http-get:*:audio/x-ms-wma:*,http-get:*:audio/flac:*,http-get:*:audio/x-flac:*,http-get:*:audio/l16:*,"
08-24 14:28:18 pulseaudio_dlna.plugins.upnp.renderer          DEBUG    sending GET_PROTOCOL_INFO to http://XXXX:57109/ConnectionManager/control:
 - 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
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:GetProtocolInfoResponse xmlns:u="urn:schemas-upnp-org:service:ConnectionManager:1"><Source></Source><Sink>http-get:*:audio/mpeg:*,http-get:*:audio/mp4:*,http-get:*:audio/m4a:*,http-get:*:audio/x-m4a:*,http-get:*:audio/m4b:*,http-get:*:audio/x-m4b:*,http-get:*:audio/x-aac:*,http-get:*:audio/wav:*,http-get:*:audio/x-ms-wma:*,http-get:*:audio/flac:*,http-get:*:audio/x-flac:*,http-get:*:audio/l16:*,</Sink></u:GetProtocolInfoResponse></s:Body></s:Envelope>
08-24 14:28:23 pulseaudio_dlna.listener                       INFO     Discovery complete.
08-24 14:28:23 pulseaudio_dlna.pulseaudio                     INFO     Added the device "DDR-63+ XXXX (DLNA)".
08-24 14:28:28 pulseaudio_dlna.pulseaudio                     INFO     on_device_updated "/org/pulseaudio/core1/sink1"
08-24 14:28:29 pulseaudio_dlna.pulseaudio                     INFO     _handle_sink_update /org/pulseaudio/core1/sink1
08-24 14:28:29 pulseaudio_dlna.pulseaudio                     INFO     Instructing the device "DDR-63+ XXXX (DLNA)" to play ...
Traceback (most recent call last):
  File "~/workspace/pulseaudio-dlna/pulseaudio_dlna/pulseaudio.py", line 572, in _handle_sink_update
    if bridge.device.play() == 200:
  File "~/workspace/pulseaudio-dlna/pulseaudio_dlna/plugins/upnp/renderer.py", line 341, in play
    if UpnpMediaRenderer.register(self, stream_url) == 200:
  File "~/workspace/pulseaudio-dlna/pulseaudio_dlna/plugins/upnp/renderer.py", line 189, in register
    url = self.service_transport.control_url
AttributeError: 'NoneType' object has no attribute 'control_url'
08-24 14:29:17 pulseaudio_dlna.pulseaudio                     INFO     on_device_updated "/org/pulseaudio/core1/sink0"
08-24 14:29:17 pulseaudio_dlna.pulseaudio                     INFO     _handle_sink_update /org/pulseaudio/core1/sink0

@masmu
Copy link
Owner

masmu commented Aug 24, 2015

Your device does not provide a AVTransport.

      <serviceList>
         <service>
            <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
            <serviceId>urn:upnp-org:serviceId:ConnectionManager_XXXX</serviceId>
            <SCPDURL>ConnectionManager/scpd.xml</SCPDURL>
            <controlURL>ConnectionManager/control</controlURL>
            <eventSubURL>ConnectionManager/event</eventSubURL>
         </service>
         <service>
            <serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
            <serviceId>urn:upnp-org:serviceId:RenderingControl_XXXX</serviceId>
            <SCPDURL>RenderingControl/scpd.xml</SCPDURL>
            <controlURL>RenderingControl/control</controlURL>
            <eventSubURL>RenderingControl/event</eventSubURL>
         </service>

         <!--
         This part is missing!
          <service>
            <serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
            <serviceId>urn:upnp-org:serviceId:AVTransport_XXXX</serviceId>
            <SCPDURL>AVTransport/scpd.xml</SCPDURL>
            <controlURL>AVTransport/control</controlURL>
            <eventSubURL>AVTransport/event</eventSubURL>
         </service>
         -->

      </serviceList>

Is that device DLNA compatible?
Or could it be possible that you have the enable the permission to control the device first in the settings?

Did you try to stream music to that device with another application? I always use BubbleUPnP (Android) for those little experiments. But I am pretty sure there are also applications for iOS which can do that.

@LGro
Copy link
Author

LGro commented Aug 24, 2015

I'm a bit puzzled also because I don't know the DLNA specifications very well...
I can access DLNA Streams with my device but not those from pulseaudio-dlna.
Just to clarify, pulseaudio-dlna does recognize DLNA devices and publishes a DLNA stream accessible for that device which for itself searches the network for DLNA streams, finds the one pulseaudio-dlna offers and connects, right?

@masmu
Copy link
Owner

masmu commented Aug 25, 2015

Almost. It searches the network for DLNA devices and adds pulseaudio sinks for every device to your system. If you play audio to such a sink, it instructs the corresponding device to play a HTTP stream which is also served by pulseaudio-dlna.

I have never encountered a device which does not provide all those 3 services. And the information the AVTransport service provides, is normally needed for instruction commands such as PLAY and STOP.

I read a bit in the UPnP-av-MediaServer-v1 specification and it seems, that if the AVTransport is not provided by default i have to request it via the ConnectionManager's PrepareForConnection action.
Since all my devices do provide this by default, i was not able to test this on my own.

Can you provide a wireshark capture of a working session of an application which handles this correctly?

I am looking for the response of the following request:

POST /ConnectionManager/control HTTP/1.1
Host: 192.168.200.13:54795
SOAPAction: "urn:schemas-upnp-org:service:ConnectionManager:1#PrepareForConnection"
Accept-Language: de-de;q=1, de;q=0.5
Accept-Encoding: gzip
Content-Type: text/xml; charset="utf-8"
User-Agent: gupnp-universal-cp GUPnP/0.20.10 DLNADOC/1.50
Connection: Keep-Alive
Content-Length: 437

<?xml version="1.0"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <u:PrepareForConnection xmlns:u="urn:schemas-upnp-org:service:ConnectionManager:1">
         <Direction>Input</Direction>
         <PeerConnectionID>0</PeerConnectionID>
         <PeerConnectionManager/>
         <RemoteProtocolInfo/>
      </u:PrepareForConnection>
   </s:Body>
</s:Envelope>

@LGro
Copy link
Author

LGro commented Aug 25, 2015

Sadly I can't get a proper network scan out of Wireshark due to my lack of network analysis skills. Can I help in any other way?

@LGro
Copy link
Author

LGro commented Aug 25, 2015

I'd like to contribute a feature such that devices without AVTransport are able to use pulseaudio-dlna.

One idea would be, to make failure of controlling the device non fatal. Meaning pulseaudio-dlna just tries to control the device but doesn't remove the sink if it can't.

The other possibility would be to specify n default streams/sinks at startup that are available for pulseaudio to assign audio sources to, independent of available devices. So users can simply connect to those sinks with their devices.

Would you be interested in either of the two proposals or do you have different suggestions?

@masmu
Copy link
Owner

masmu commented Aug 25, 2015

If you own a FritzBox it is very simple to do that. You can capture your whole traffic, even wifi.
I can guide you through the process.
My goal is to increase the overall compatibility of pulseaudio-dlna. Other people would benefit from that too.

What is the benefit of making the process not fatal? It would not be usable in both cases, except you plan to instruct your device yourself to play the stream.

The n default sink idea is interesting, but that is not really the sense of the project.
I think people would find it very confusing when they switch their application streams to such a sink and after that they have to make their devices play them.
Besides that is would be much simpler to customize an existing full stack DLNA server to get that feature.

@LGro
Copy link
Author

LGro commented Aug 29, 2015

The Sangean DDR-63+ dosn't seem to support the required AVTransport implementation of the DLNA standard.

@LGro LGro closed this as completed Aug 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants