fromMap static method

RtcInboundRtpStreamStats fromMap(
  1. dynamic stats
)
override

Creates RtcInboundRtpStreamStats basing on the Map received from the native side.

Implementation

static RtcInboundRtpStreamStats fromMap(dynamic stats) {
  RtcInboundRtpStreamMediaType? mediaType;
  if (stats['kind'] == 'audio') {
    mediaType = RtcInboundRtpStreamAudio(
        tryParse(stats['totalSamplesReceived']),
        tryParse(stats['concealedSamples']),
        tryParse(stats['silentConcealedSamples']),
        stats['audioLevel'],
        stats['totalAudioEnergy'],
        stats['totalSamplesDuration'],
        stats['voiceActivityFlag']);
  } else if (stats['kind'] == 'video') {
    mediaType = RtcInboundRtpStreamVideo(
      stats['framesDecoded'],
      stats['keyFramesDecoded'],
      stats['frameWidth'],
      stats['frameHeight'],
      stats['totalInterFrameDelay'],
      stats['framesPerSecond'],
      stats['firCount'],
      stats['pliCount'],
      stats['concealmentEvents'],
      stats['framesReceived'],
      stats['sliCount'],
    );
  }

  return RtcInboundRtpStreamStats(
      stats['trackId'],
      tryParse(stats['bytesReceived']),
      stats['packetsReceived'],
      stats['totalDecodeTime'],
      tryParse(stats['jitterBufferEmittedCount']),
      mediaType);
}