rollingEstimatedBitrateBps method

double rollingEstimatedBitrateBps({
  1. required double framerate,
})

Derived rolling-window bitrate estimate (bits/sec) using the supplied framerate, analogous to estimatedBitrateBps but computed only over the most recent rollingWindowFrames non-dropped frames. 0.0 when rolling stats are disabled or the window is empty. framerate must be > 0.

Implementation

double rollingEstimatedBitrateBps({required double framerate}) {
  if (framerate <= 0) {
    throw ArgumentError('framerate must be > 0 (got $framerate)');
  }
  if (_ringFill == 0) return 0.0;
  var sum = 0;
  for (var i = 0; i < _ringFill; i++) {
    sum += _ringBytes[i];
  }
  return (sum * 8.0 * framerate) / _ringFill;
}