monitorStats method

  1. @override
Future<bool> monitorStats()
override

Implementation

@override
Future<bool> monitorStats() async {
  if (receiver == null && events.isDisposed) {
    _currentBitrate = 0;
    return false;
  }
  final stats = await getReceiverStats();

  if (stats != null && prevStats != null && receiver != null) {
    _currentBitrate = computeBitrateForReceiverStats(stats, prevStats);
    events.emit(AudioReceiverStatsEvent(
        stats: stats, currentBitrate: currentBitrate));
  }

  prevStats = stats;
  return true;
}