WebRTC over TCP and the channel queue limits

Dani

Member
what happens when a TCP channel's queue reaches ice_tcp_channel_high_water_mark? (5.3.498)?


Setup

  • WCS 5.3.498 on a single node, Web SDK 2.0.286, WebRTC only.
  • We use WCS for one-to-one video sessions:
    • the first party publishes a 720p video stream at about 2.5 Mbps, plus a separate audio stream;
    • the second party plays both streams.
  • All publishing and playing uses WebRTC over TCP (transport: "TCP" in the Web SDK).
  • The TCP queue settings are at their defaults.
Problem

When one side has a weak connection (for example mobile 3G), the round-trip time reported by the browser's getStats keeps growing, instead of the video dropping frames:

  • for a second party with a weak downlink, up to about 57 s;
  • for a first party with a weak uplink, up to about 37 s.
After that the connection is closed. It looks as if the media is being queued rather than dropped, so the delay grows until the session dies.

We found two different defaults for the TCP queue limits in the documentation:

  • The flashphoner.properties settings page: ice_tcp_channel_high_water_mark = 104857600, ice_tcp_channel_low_water_mark = 10485760.
  • The "Publishing and playing stream via WebRTC over TCP" page: 52428800 / 5242880.
Questions

  1. Which defaults apply in 5.3.498?
  2. Do the limits apply per channel, meaning per player or publisher connection?
  3. When a channel's queue reaches the high water mark, what does WCS do? Does it drop packets (all of them, or video only) until the low water mark? Does it stop writing? Does it close the connection?
  4. For a slow TCP player we would rather lose frames and recover with a key frame than fall tens of seconds behind. What values would you recommend for a 2.5 Mbps stream? Are these settings the right tool, or is there a better one?
  5. Is there a statistic for a channel's queue size, or for how often the limit is reached? We found tcp_channel_stats (channels_not_writable).
  6. Would you recommend ice_tcp_nio=true for this case on 5.3.498?
Thank you.
 
Good day.
The flashphoner.properties settings page: ice_tcp_channel_high_water_mark = 104857600, ice_tcp_channel_low_water_mark = 10485760.
These are the default values
The "Publishing and playing stream via WebRTC over TCP" page: 52428800 / 5242880
And these are the recommended values for that case. Note that they are half as much as defaults.
Which defaults apply in 5.3.498?
ice_tcp_channel_high_water_mark = 104857600, ice_tcp_channel_low_water_mark = 10485760
Do the limits apply per channel, meaning per player or publisher connection?
Yes
When a channel's queue reaches the high water mark, what does WCS do? Does it drop packets (all of them, or video only) until the low water mark? Does it stop writing? Does it close the connection?
If the number of bytes queued in the TCP outgoing channel write buffer exceeds the high water mark, the channel becomes non-writable (and increments channels_not_writable stats value. So WCS should stop sending a new bytes to the buffer.
Then, if the number of bytes queued drops down below the low water mark, the channel becomes writable again. WCS should send a new bytes to the buffer.
For a slow TCP player we would rather lose frames and recover with a key frame than fall tens of seconds behind. What values would you recommend for a 2.5 Mbps stream? Are these settings the right tool, or is there a better one?
You may decrease the watermarks, for example
Code:
ice_tcp_channel_high_water_mark = 5242880
ice_tcp_channel_low_water_mark = 524288
You may also use lower video resolution/bitrate for poor channel. This requires stream transcoding at server side, but viewer receives a more smooth picture without freezes if you stream 640x360 at 500 kbps for example.
Is there a statistic for a channel's queue size, or for how often the limit is reached? We found tcp_channel_stats (channels_not_writable).
This stats value shows all the TCP channels in non-writable state as we described above.
Would you recommend ice_tcp_nio=true for this case on 5.3.498?
No. This does not affect the case.
 
Top