MOSCalculator

public class MOSCalculator

Utility class for calculating Mean Opinion Score (MOS) and call quality metrics

  • Calculates the Mean Opinion Score (MOS) based on WebRTC statistics

    Declaration

    Swift

    public static func calculateMOS(jitter: Double, rtt: Double, packetsReceived: Int, packetsLost: Int) -> Double

    Parameters

    jitter

    Jitter in milliseconds

    rtt

    Round-trip time in milliseconds

    packetsReceived

    Number of packets received

    packetsLost

    Number of packets lost

    Return Value

    MOS score in the inclusive range 1.0...5.0, or NaN when the inputs are non-finite or the computation overflows. Callers should pair the result with getQuality(mos:), which maps NaN to .unknown.

  • Determines call quality based on MOS score.

    Non-finite inputs (NaN, ±infinity) are reported as .unknown. For finite values the bands are continuous — every non-negative MOS value maps to exactly one rating, with no gaps between bands.

    Declaration

    Swift

    public static func getQuality(mos: Double) -> CallQuality

    Parameters

    mos

    Mean Opinion Score

    Return Value

    Call quality rating