GstNetBalancer - User Guide
GstNetBalancer A GStreamer Network Balancer Element |
---|
About NetBalancer Plugin |
Getting Started |
User Guide |
Examples |
Contact Us |
Main Properties
This element balances the network load by distributing the packages over time. To do so netbalancer provides 3 main properties:
- bandwidth: defines the maximum desired bandwidth in kbps.
- distribution_factor: defines the number of intervals in a second used to fine control the bandwidth. A larger number produces more distributed data but a too large value can add extra delays not required.
- min_delay: add a minimum delay between each pair of consecutive packets.
You can adjust these properties to fit your network and stream conditions. The following figure shows a representation of the element properties.
In general, the netbalancer will distribute the bandwidth between the intervals, allowing only to send a portion of the bandwidth in each interval. If the stream provides more bytes than the bytes assigned to an interval time, the netbalancer will wait until the next interval to send them.
Also you can define a minimum delay between packets to have a minimal uniform distribution.
The complete list of properties for the netbalancer can be seen using the following command:
gst-inspect-1.0 netbalancer
How to choose properties values
It is important to set the properties above carefully in order to achieve the expected results.
The bandwidth property
This property is set based on the network capabilities; however, in most cases, this parameter by itself is not enough to balance the transmission.
As shown in figure 2 both cases A and B have the same bandwidth and transmit the same amount of bytes per second; however, the network load is distributed in two very different patterns. This is where the distribution factor comes into play.
The distribution_factor property
This property splits the bandwidth specified for a second into smaller intervals. This allows limiting the transmission with more control while keeping the same bandwidth.
Figure 2 A has a distribution factor of 30
, which means that the 1.34Mbps
is not limited as 1.34Mb = 167500B
every 1s
, but instead it is limited as 5600B
every 33ms
.
Figure 2 B takes this even further, instead of being limited to 5600B
every 33ms
this one uses a distribution factor of 120
so it divides the previous intervals into fourths; meaning that the bandwidth is seen as 1400B
every 8.25ms
.
Notice how all of these configurations still keep a 1.34Mbps
bandwidth but the overall behavior and limitations are different.
The min_delay property
This property is used to add a minimum separation between packets to make sure they are distributed properly. It is useful since a time window will likely have multiple packets in it and it is not realistic to have a packet per window. Adding this delay requires you to know the maximum number of packets in each window. If a worst case scenario means that every 33ms
window will have 10
packets. Then a delay of 33ms/10
can be added so that all packets still fit into that frame but are evenly distributed. This is done for a worst case scenario because otherwise, the delays would push packets out of their expected time window.
Examples
Please refer to the Demo page for a more detailed real life example of how to set the element parameters.