parse static method

ReportBlock parse(
  1. ByteData bd,
  2. int offset
)

Implementation

static ReportBlock parse(ByteData bd, int offset) {
  final ssrc = bd.getUint32(offset);
  final flCl = bd.getUint32(offset + 4);
  final fl = (flCl >> 24) & 0xFF;
  var cl = flCl & 0x00FFFFFF;
  if ((cl & 0x00800000) != 0) cl |= 0xFF000000; // sign-extend 24→32
  return ReportBlock(
    ssrc: ssrc,
    fractionLost: fl,
    cumulativeLost: cl.toSigned(32),
    extendedHighestSeq: bd.getUint32(offset + 8),
    jitter: bd.getUint32(offset + 12),
    lastSr: bd.getUint32(offset + 16),
    delaySinceLastSr: bd.getUint32(offset + 20),
  );
}