📜 ⬆️ ⬇️

Properly set up a DLNA server for Samsung TVs

Hello, dear habravchane! I am the proud owner of a Samsung TV with AllShare function. For the convenience of watching videos over the network from my home server, I picked up a minidlna. However, for several months, I was never able to achieve stable operation of the Samsung + minidlna bundle: playback over the network was suddenly interrupted at different intervals and the server itself was not always and not immediately detected by the TV. Breaking a bunch of forums and having tried many different options and options (including the mediatomb server), I did find a working solution.


1. Problem with server unavailability


In this post , a solution to the indicated problem has already been cited: the author proposes to reduce notify_interval, because the TV does not want to poll the network for the presence of DLNA servers. However, in my case, tcpdump honestly outputted a bunch of ssdp packets when you turned on the TV, but the server did not show up on the TV. Googling, I found that on the network interface on which the minidlna hangs, you need to enable multicast and set the broadcast address, which I did:
ip link set br0 multicast on ip link set br0 broadcast 192.168.1.255 

Voila! After restarting the network, the TV quietly discovered the minidlna!

2. Problem with video interruption over the network


This is where notify_interval comes in handy. Only it must not be reduced, but increased. The thing is that, as far as I understand, the SSDP protocol involves sending the server alive packets, in the header of which the max-age parameter is transmitted. And if after the time specified in max-age, a new alive-package does not come, the TV breaks the connection.
A snippet of code from miniddna’s minissdp.c file, from which it can be seen that the max-age parameter is taken as notify_interval + 10:
Hidden text
 l = snprintf(buf, sizeof(buf), "HTTP/1.1 200 OK\r\n" "CACHE-CONTROL: max-age=%u\r\n" "DATE: %s\r\n" "ST: %s%s\r\n" "USN: %s%s%s%s\r\n" "EXT:\r\n" "SERVER: " MINIDLNA_SERVER_STRING "\r\n" "LOCATION: http://%s:%u" ROOTDESC_PATH "\r\n" "Content-Length: 0\r\n" "\r\n", (runtime_vars.notify_interval<<1)+10, szTime, known_service_types[st_no], (st_no>1?"1":""), uuidvalue, (st_no>0?"::":""), (st_no>0?known_service_types[st_no]:""), (st_no>1?"1":""), host, (unsigned int)port); 

Thus, if for some reason the new alive package did not reach the TV in the time specified in max-age, the broadcast will be interrupted. We use simple workaround - we increase the notify_interval up to several hours:
 notify_interval=10000 

After that, I personally had no more breaks. I hope that this information is useful to someone else.
')
PS For mediatomb, you need to correct the parameter alive in config.xml.

UPD: I found a great tip on the net: it is advised to disable multicast_snooping to solve problems with multicast:
 echo 0 > /sys/devices/virtual/net/$BRIDGE/bridge/multicast_snooping 

Perhaps this will solve all the problems, and asking a huge notify_interval will be superfluous. I test - accomplish your goal.

Source: https://habr.com/ru/post/167723/


All Articles