To avoid the case where a single data point or too short window is used,
causing bad behavior due to bad stats, update RateStatistics to return
an Optional rather than a plain rate.
There was also a strange off by one bug where the rate was slightly
overestimated (N + 1 buckets, N ms time window).
These changes requires updates to a number of places, and may very well
cause seeming perf regressions (but the stats were probablty more wrong
previously).
BUG=
R=mflodman@webrtc.org, stefan@webrtc.org
Review URL: https://codereview.webrtc.org/2029593002 .
Cr-Commit-Position: refs/heads/master@{#13103}
This is done by changing the RateStatistics so that it resets its window when the accumulator is empty. It also keeps a dynamic window, so that the rates computed before a full window worth of data has been received will be computed over a smaller window. This means that the rate will be closer to the true rate, but with a higher variance.
BUG=webrtc:5773
R=perkj@webrtc.org, sprang@webrtc.org
Review URL: https://codereview.webrtc.org/1908893003 .
Cr-Commit-Position: refs/heads/master@{#12470}