Update RateStatistics to handle too-little-data case.

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-Original-Commit-Position: refs/heads/master@{#13103}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 51e60305e622f9156d37cb1f487bd4260d5ce410
17 files changed