VPN causes instability with IPTV in Channels

My server sits behind a router-based VPN for security, but I've found this causes instability with IPTV with Channels and streams will often freeze every few minutes and need to be stopped and restarted to play again. This happens on both tvOS and iOS apps. The picture literally freezes on a frame, and the 'connection lost' message appears a minute or two later. When this happens, the only thing that shows up in the DVR log are messages like the ones below, and it appears Channel is still receiving data.

2021/01/10 12:59:15.761645 [WRN] Buffer for M3U-Primary ch1154 is more than 50% full (clients=1, len=33559456)
2021/01/10 12:59:42.938838 [WRN] Buffer for M3U-Primary ch1154 is more than 75% full (clients=1, len=50332679)
2021/01/10 13:00:03.881934 [WRN] Buffer for M3U-Primary ch1154 is more than 95% full (clients=1, len=63754512)
2021/01/10 13:00:08.927926 [WRN] Buffer for M3U-Primary ch1154 is more than 99% full (clients=1, len=66441765)

I've tried connecting to different VPN servers and even different VPN providers with no change in behaviour. If I remove the VPN and allow the server a direct network connection, then the streams are stable and can play for literally hours without interruption.

I've tested the same IPTV streams in VLC on the same server with it behind the VPN and I don't get any interruptions, again literally for hours of testing at a time. I'm wondering if the Channels M3U/streaming implementation is somehow more sensitive to latency and/or minor errors in the steam and VLC is better able to recover from them? (Though in my testing in VLC I've seen only about 300 dropped video frames in about 3 continuous hours of testing, so they seem pretty stable.)

Is there anything that can be done? I really don't want to take the VPN out of the picture...I'm a bit paranoid about security since I discovered someone trying to hack my server a while back.

EDIT: Forgot to note, running the latest pre-release of the DVR and testing with both the latest stable and beta releases of the tvOS and iOS clients. IPTV streams are mpeg-ts.

Buffer full messages generally point to disk speed issues, or other resource exhaustion like cpu or memory.

Though if the client is disconnecting that would also explain why the server buffer starts filling up.

Sounds like your router is getting overloaded and dropping connections?

The router is no slouch (ASUS RT-AC86U with 1.8 GHz dual core cpu, 512 MB RAM) and resource utilisation seems low and stable with or without the VPN connection. I've also tried running the VPN client on the server directly instead of the router and getting the same issue in Channels.

With VPN still enabled on the router and playing the same streams in VLC on the server or on another computer on the LAN, there are no drops in the connection. I've tested playing the same stream at the same time both in VLC and in Channels. Channels will freeze and disconnect after a few minutes whilst VLC keeps chugging along indefinitely.

I've also tested opening a stream through the DVR (e.g., http://x.x.x.x:8089/devices/ANY/channels/2202/stream.mpg?format=ts) and playing it in VLC both on a laptop and Apple TV. Streams will play for about 30 minutes before a freeze and buffer fill vs about 5 minutes through the Channels clients.

Trust me, I've been racking my brain for days trying to nail down the issue before coming to the forums. I'm stumped at this point. :slight_smile: I really don't know how using a VPN could be affecting the connection between the local clients and the DVR. And just for completeness: this only affects internet-based streams; anything on the local network (HDHR and SAT>IP) is unaffected.