gsthlsdemux.c/gstadaptivedemux.c: Possible Improvement: Variant selection doesn't consider hysteresis
Submitted by David Guthrie
Link to original bug (#747558)
Description
When the average bitrate is calculated, this resultant bitrate (when multiplied by bitrate_limit) could be very close to a variant in the m3u8 playlist file. Which could result in the variant selection oscillating between two different variants after each segment is downloaded. In any system which make a decision based on an input switching an output based on the inputs magnitude, it is normal to add hysteresis to the calculation as this will prevent random noise from causing instability. The instability in this cause would be the viewer being able to observe frequent changes in variants when playing back video.
A hysteresis variable could be added to the final bitrate value used to select the variant from the playlist. This variable is set to -50kbps when changing download a variant and set to 0 when changing up a variant. This would allow for 50kbps of noise in the final bitrate calculation which would not influence the variant selection when the download rate is near constant.