jellyfin / jellyfin-plugin-dlna

GNU General Public License v3.0
16 stars 12 forks source link

DLNA PlayTo: No device info updated when TV offline or restart #10

Open xiaolei0125 opened 3 years ago

xiaolei0125 commented 3 years ago

Describe the bug

DLNA PlayTo can not play to TV when AndroidTV offline or restart, since DLNA PlayTo not update device info.
Need to restart Jellyfin server to get and create the lastest DLNA Player's info.

If AndroidTv or other DLNA player offine or restart, some DLNA player may change the RemoteEndPoint ip or port, eg: "http://192.168.1.80:49153/description.xml" -> "http://192.168.1.80:49000/description.xml".

But DLNA PlayTo still used the old device info, so it's failed to play.

System (please complete the following information):

BaronGreenback commented 3 years ago

Looks to be an issue with how it implements the sessions. https://github.com/jellyfin/jellyfin/blob/2f0ec9a70bfc145b3bf4d7159738ff94839cd0cf/Emby.Dlna/PlayTo/PlayToManager.cs#L110

Each device has a USN. The USN is used to identify the device. If the device is detected by the system a 2nd time - it's properties aren't update - as it's assumed nothing has changed. This is wrong - as the IP etc may have altered.

Interestingly, DLNA v1.1 or 2 (i can't remember which) states that the USN of the device should change on a network change - which would solve this issue.

xiaolei0125 commented 3 years ago

@BaronGreenback Thank you for your reply.

As far as I know, many DLNA players will not change the USN When the network change or restart.

Maybe we should update the device information(eg. "location": "http://192.168.1.80:49000/description.xml") Whenever we receive a NOTIFY message.

We can also check whether the DLNA players is offline through 'CACHE-CONTROL:max-age=1800' in the NOTIFY message.

BaronGreenback commented 3 years ago

It's currently set up only to process notify messages that it doesn't know about - as on a large network the number of notifications can be quite substantial. A number of devices running JF are low powered, so we try to keep processing at a minimum. It would cache out and work eventually, but who want to wait ???