Correctly configure the DLNA server for Samsung TVs

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


    1. Problem with server unavailability


    In this post , a solution to the indicated problem has already been cited: the author suggests reducing notify_interval, because the TV does not want to poll the network for the presence of DLNA servers. However, in my case, tcpdump honestly displayed a bunch of ssdp packets when the TV was turned on, but the server was not detected by the TV. Googling, I found that on the network interface on which 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 calmly detected minidlna!

    2. The problem with interrupting video over the network


    And here notify_interval is useful to us. Only it must not be reduced, but increased. The thing is that, as I understand it, the SSDP protocol implies the server sends alive packets, in the header of which the max-age parameter is passed. And if, after the time specified in max-age has passed, a new alive packet does not arrive, the TV disconnects.
    A snippet of code from the minissdp.c file from minidlna, which shows 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 packet has not reached the TV set in the max-age time, the broadcast will be interrupted. We use a simple workaround - increase notify_interval to several hours:
    notify_interval=10000

    After that, personally, I no longer had gaps. I hope this information is useful to someone else.

    PS For mediatomb you need to fix the alive parameter in config.xml.

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

    Perhaps this will solve all the problems, and setting a huge notify_interval will be superfluous. I will test - I will unsubscribe.

    Also popular now: