shouldDrop method

bool shouldDrop({
  1. required bool isKey,
})

Return true if the next non-key frame should be dropped instead of encoded. Keyframes are never dropped (recovery must be possible).

Implementation

bool shouldDrop({required bool isKey}) {
  if (isKey) return false;
  if (_consecutiveDrops >= maxConsecutiveDrops) return false;
  final windowBits = targetBitrateBps * bufferWindowSeconds;
  final fullness = _bufferBits / windowBits;
  return fullness > dropOvershootFullness;
}