tobexyz / yaacc-code

YAACC - UPNP Client and Server
Other
94 stars 13 forks source link

Freecom Musicpal sends UPnP packets linking to 127.0.0.1 #17

Closed cweiske closed 5 years ago

cweiske commented 5 years ago

When YAACC 2.1.1 is running in my network, it throws this exception repeatedly:

W StreamClient: HTTP connection failed: (StreamRequestMessage) GET http://127.0.0.1:9000/TMRDeviceDescription.xml
W StreamClient: java.net.ConnectException: Connection refused
W StreamClient:     at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
W StreamClient:     at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:742)
W StreamClient:     at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:125)
W StreamClient:     at org.eclipse.jetty.client.SelectConnector.startConnection(SelectConnector.java:79)
W StreamClient:     at org.eclipse.jetty.client.HttpDestination.startNewConnection(HttpDestination.java:292)
W StreamClient:     at org.eclipse.jetty.client.HttpDestination.doSend(HttpDestination.java:597)
W StreamClient:     at org.eclipse.jetty.client.HttpDestination.send(HttpDestination.java:532)
W StreamClient:     at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:180)
W StreamClient:     at org.fourthline.cling.transport.impl.jetty.StreamClientImpl$2.call(StreamClientImpl.java:114)
W StreamClient:     at org.fourthline.cling.transport.impl.jetty.StreamClientImpl$2.call(StreamClientImpl.java:108)
W StreamClient:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W StreamClient:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
W StreamClient:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
W StreamClient:     at java.lang.Thread.run(Thread.java:761)
W trieveRemoteDescriptors: Device descriptor retrieval failed, no response: http://127.0.0.1:9000/TMRDeviceDescription.xml

This is because one of my UPnP radios, a Freecom Musicpal, sends different UPnP discovery(?) packets:

It actually sends the first packet 9 times, then 9 times the second packet.

I think YAACC should not try to request a file when the host is 127.0.0.1.

Full UPnP packets

First

HTTP/1.1 200 OK
CACHE-CONTROL: max-age=1810
DATE: Wed, 09 Jan 2019 20:29:19 GMT
EXT:
LOCATION: http://192.168.3.43:9000/TMRDeviceDescription.xml
SERVER: Linux/2.x.x, UPnP/1.0, pvConnect UPnP SDK/1.0, TwonkyMedia UPnP SDK/1.1
ST: urn:schemas-upnp-org:device:MediaRenderer:1
USN: uuid:54776f6e-6b79-4d65-641e-0001db085e2f::urn:schemas-upnp-org:device:MediaRenderer:1
Content-Length: 0

Second

HTTP/1.1 200 OK
CACHE-CONTROL: max-age=1810
DATE: Wed, 09 Jan 2019 20:29:20 GMT
EXT:
LOCATION: http://127.0.0.1:9000/TMRDeviceDescription.xml
SERVER: Linux/2.x.x, UPnP/1.0, pvConnect UPnP SDK/1.0, TwonkyMedia UPnP SDK/1.1
ST: urn:schemas-upnp-org:device:MediaRenderer:1
USN: uuid:54776f6e-6b79-4d65-641e-0001db085e2f::urn:schemas-upnp-org:device:MediaRenderer:1
Content-Length: 0
tobexyz commented 5 years ago

thx. for reporting the problem. I wil take a look on it.

tobexyz commented 5 years ago

causes this exception errors in yaacc or is it nevertheless possible to work with the device?

cweiske commented 5 years ago

It partially works. When selecting a song and then pressing "play", the MusicPal does indeed play, but a from its local USB drive.

With BubbleUPnP, I can play a song selected with it.

tobexyz commented 5 years ago

please give it a try using branch async_load_issues

cweiske commented 5 years ago
D de.yaacc.player.AVTransportPlayer: Action SetAVTransportURI 
D de.yaacc.player.AVTransportPlayer: Action Stop
D de.yaacc.player.AVTransportPlayer: Action completed!
D de.yaacc.player.AVTransportPlayer: ReferencedRepresentationTimeOffset: P00:06:14.992 000 000
D de.yaacc.player.AVTransportPlayer: current time: Thu Feb 14 00:06:40 GMT+01:00 2019 get execution time: Thu Feb 14 00:06:14 GMT+01:00 2019
D de.yaacc.player.AVTransportPlayer: ExecutionTime is in past!! We will start immediately
D de.yaacc.player.AVTransportPlayer: Cancle Notification with ID: 460390096
D de.yaacc.player.AVTransportPlayer: Exception while unbind service
D de.yaacc.player.PlayerService: Get Player for id 460390096
D de.yaacc.player.PlayerService: Get Player not found
D de.yaacc.player.PlayerService: Get Player for id 460390096
D de.yaacc.player.PlayerService: Get Player not found
D de.yaacc.player.AVTransportPlayerActivity: Ignore exception on unbind service while activity pause
D de.yaacc.browser.TabBrowserActivity: Stopping local service
W ActivityManager: Bad activity token: android.os.BinderProxy@d2d3ca7
W ActivityManager: java.lang.ClassCastException: android.os.BinderProxy cannot be cast to com.android.server.am.ActivityRecord$Token
W ActivityManager:  at com.android.server.am.ActivityRecord.forTokenLocked(ActivityRecord.java:594)
W ActivityManager:  at com.android.server.am.ActivityRecord.isInStackLocked(ActivityRecord.java:1347)
W ActivityManager:  at com.android.server.am.ActivityManagerService.getActivityOptions(ActivityManagerService.java:12831)
W ActivityManager:  at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:1933)
W ActivityManager:  at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2974)
W ActivityManager:  at android.os.Binder.execTransact(Binder.java:565)
D de.yaacc.upnp.UpnpClient: remoteDeviceUpdated: Ivo Clarysse, Henner Zeller gmediarender 2017-12-10_704b182
D de.yaacc.upnp.UpnpClient: remoteDeviceUpdated: Ivo Clarysse, Henner Zeller gmediarender 2017-12-10_704b182
D de.yaacc.upnp.UpnpClient: remoteDeviceUpdated: Ivo Clarysse, Henner Zeller gmediarender 2017-12-10_704b182
D de.yaacc.upnp.UpnpClient: remoteDeviceUpdated: Ivo Clarysse, Henner Zeller gmediarender 2017-12-10_704b182
D de.yaacc.upnp.UpnpClient: remoteDeviceUpdated: Ivo Clarysse, Henner Zeller gmediarender 2017-12-10_704b182
D de.yaacc.upnp.UpnpClient: remoteDeviceUpdated: Ivo Clarysse, Henner Zeller gmediarender 2017-12-10_704b182
D de.yaacc.player.AVTransportPlayerActivity: Ignore exception on unbind service while activity destroy
E ActivityThread: Activity de.yaacc.player.AVTransportPlayerActivity has leaked ServiceConnection de.yaacc.player.AVTransportPlayerActivity@c730402 that was originally bound here
E ActivityThread: android.app.ServiceConnectionLeaked: Activity de.yaacc.player.AVTransportPlayerActivity has leaked ServiceConnection de.yaacc.player.AVTransportPlayerActivity@c730402 that was originally bound here
E ActivityThread:   at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1336)
E ActivityThread:   at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1231)
E ActivityThread:   at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1450)
E ActivityThread:   at android.app.ContextImpl.bindService(ContextImpl.java:1422)
E ActivityThread:   at android.content.ContextWrapper.bindService(ContextWrapper.java:636)
E ActivityThread:   at de.yaacc.player.AVTransportPlayerActivity.onCreate(AVTransportPlayerActivity.java:321)
E ActivityThread:   at android.app.Activity.performCreate(Activity.java:6684)
E ActivityThread:   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
E ActivityThread:   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2637)
E ActivityThread:   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2751)
E ActivityThread:   at android.app.ActivityThread.-wrap12(ActivityThread.java)
E ActivityThread:   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1496)
E ActivityThread:   at android.os.Handler.dispatchMessage(Handler.java:102)
E ActivityThread:   at android.os.Looper.loop(Looper.java:154)
E ActivityThread:   at android.app.ActivityThread.main(ActivityThread.java:6186)
E ActivityThread:   at java.lang.reflect.Method.invoke(Native Method)
E ActivityThread:   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
E ActivityThread:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
W ActivityManager: Unbind failed: could not find connection for android.os.BinderProxy@9ec1131
D de.yaacc.player.PlayerService: Get Player for id 460390096
D de.yaacc.player.PlayerService: Get Player not found

I do not know how good the MusicPal UPnP implementation is (my guess: bad), and maybe you should not invest more time here. Simply being rid of the 127.0.0.1 exception is enough for me.

tobexyz commented 5 years ago

I do not know how good the MusicPal UPnP implementation is (my guess: bad), and maybe you should not invest more time here. Simply being rid of the 127.0.0.1 exception is enough for me.

But if the exception is gone and it doesn't work at all where is the improvement? Does the exception kills yaacc before? I do not know which side effects my change in cling has, so it's important to know if it is really needed

cweiske commented 5 years ago

The exception does not occur anymore on 2.3.0