Sunday, February 10, 2019

Streaming Bandwidth Limitation of Slingbox and Solution

This post shows how the streaming bandwidth of Slingbox is limited by delay between Slingbox and the client despite sufficient bandwidth available between them. This is a common situation for users of Slingbox streaming videos over a long distance.  A solution to this problem by using TCP proxy is shown in the end.  All experiments were done with Slingbox 350.

Streaming Bandwidth Limitation

Delay between Slingbox and the client limits the streaming bandwidth despite very high bandwidth available between them.  This was found by an experiment where delay is deliberately inserted between Slingbox the client that are physically located very close to each other.

The following figure shows the measured video bit rate versus the round-trip delay inserted between Slingbox and the client.  Up to about 20 ms of round-trip delay, the maximum video bit rate of 8 Mbps is maintained, but it starts decreasing as the delay increases.  For example, the typical round-trip delay between Tokyo and New York of 220 ms limits the streaming bit rate to about 2.5 Mbps.

Slingbox video bit rate versus round-trip delay.

In normal TCP communication, TCP window size is dynamically adjusted so the delay will not be a limiting factor of bandwidth.  However, it appears that window control is not very effective with Slingbox or some unique flow control is used in conjunction with Slingbox's proprietary streaming technology.

Solution

It was found by experiment that delay in up to and including the TCP layer matters, but that in higher layers does not limit the streaming bandwidth.  Therefore, inserting a TCP proxy physically close to Slingbox solves the problem.  This way, Slingbox talks to the proxy in the TCP level with a very small delay while it directly talks to the client in the application layer with a large delay.  This is described in the figure below.


Direct connection and connection via a TCP proxy.


Practically speaking, SlingPlayer doesn't allow direct entry of Slingbox's IP address.  Therefore, DNAT must be inserted somewhere between the client and TCP proxy so Slingbox's IP address is converted to that of the TCP proxy.  This is fairly easy on Linux with iptables.  A TCP proxy can also easily be set up with socat on Linux.

With this approach, it was confirmed that stable streaming at the max rate of 8 Mbps is achievable in a real use case where the streaming bandwidth is normally limited to around 3 Mbps with a round trip delay of about 150 ms.