کنارِ هم دیدنِ یک کسرِ اتلاف و یک شمارندهٔ منفی در گزارشِ تماس، لزوماً تناقض نیست. این دو عدد می‌توانند دربارهٔ دو بازهٔ متفاوت حرف بزنند و دریافت‌های تکراری نیز در حساب شرکت کنند. در این درس فقط دو فیلدِ اتلافِ گزارش RTCP را از شمارنده‌های ساختگی می‌سازیم. داده از تماس یا شبکه نیامده است؛ هدف، خواندنِ درستِ عدد و قالبِ آن است، نه اندازه‌گیریِ کیفیتِ شنیداری.

۱. دو عددِ اتلاف، دو پرسشِ متفاوت

پنجرهٔ گزارش با سابقهٔ انباشته یکسان نیست
تصویر مفهومی: پنجرهٔ گزارش با سابقهٔ انباشته یکسان نیست؛ بدون مقیاس عددی و مستقل از نتایج اجرای کد.

در بخشِ ۶٫۴٫۱ از RFC 3550، fraction lost به فاصلهٔ گزارشِ قبلی تا گزارشِ جاری مربوط است؛ cumulative lost از آغازِ دریافت حساب می‌شود. اولی یک فیلدِ هشت‌بیتیِ بدونِ علامت و دومی یک شمارندهٔ علامت‌دارِ ۲۴بیتی است. برای خواندنِ گزارش باید ابتدا بدانیم عدد مربوط به کدام بازه است؛ مقایسهٔ مستقیمِ دو مقدار، بدونِ توجه به این تفاوت، معنای روشنی ندارد.

مثالِ ما از حالتِ آغازینِ صفر به زوجِ انتظارِ ده و دریافتِ هشت می‌رسد. در بازه، دو بسته کمتر دریافت شده و شمارندهٔ انباشته نیز دو است. در مشاهدهٔ بعدی، انتظار بیست و دریافت نوزده می‌شود: بازهٔ تازه ده انتظار و یازده دریافت دارد، ولی اختلافِ انباشته هنوز یک است. بنابراین صفر شدنِ کسرِ بازه‌ای، پاک شدنِ تمامِ سابقهٔ اختلاف را نشان نمی‌دهد.

این حساب با ردگیریِ شکافِ یکتای توالی RTP یکسان نیست. آن درس شناسه‌های دیده‌نشده را در بازهٔ مشاهده‌شده دنبال می‌کند؛ اینجا هر دریافتِ شمرده‌شده، از جمله نسخهٔ تکراری، در received شرکت می‌کند. از طرفی، مقایسهٔ الگوی حذف و رگه‌های متوالی ترتیبِ حذف‌های ازپیش‌معلوم را بررسی می‌کرد. دو فیلدِ فعلی چنین ترتیب یا رگه‌ای را نگه نمی‌دارند.

۲. قراردادِ شمارنده و بازه را روشن کنیم

شمارندهٔ دریافت با شمارِ اعضای یکتا فرق دارد
تصویر مفهومی: شمارندهٔ دریافت با شمارِ اعضای یکتا فرق دارد؛ بدون مقیاس عددی و مستقل از نتایج اجرای کد.

هر تصویرِ شمارنده دقیقاً تاپلِ دوعضویِ expected و received است. expected اندازهٔ بازهٔ توالیِ پذیرفته‌شده تا بالاترین شماره است؛ تعدادِ برنامه‌ریزی‌شدهٔ ارسال در فرستنده نیست. در پیوست A.3، این اندازه از بالاترین شمارهٔ امتدادی، شمارهٔ مبنا و یک واحدِ شمولِ دو انتها ساخته می‌شود. تابعِ ما این مرحله را اجرا نمی‌کند و شمارندهٔ معتبرِ آماده می‌گیرد؛ اعتبارسنجیِ منبع و بازکردنِ شمارهٔ چرخشی بیرونِ قرارداد هستند.

دو تصویر باید از یک منبع و یک دورهٔ بدونِ بازنشانی باشند. مقدارها صحیحِ دقیق، نامنفی و حداکثر یک‌میلیاردند؛ بولی، اعشاری، رشته و عقب‌رفتنِ شمارنده رد می‌شوند. سقفِ یک‌میلیارد سیاستِ آموزشی است. حالتِ بدونِ آغاز فقط زوجِ صفر و صفر است؛ در حالتِ آغازشده هر دو مقدار مثبت‌اند؛ اگر فقط یک دریافت داشته باشیم، بازه نیز یک است، زیرا همان بسته هر دو انتهای بازه را تعیین می‌کند. این کنترل‌ها جایِ بررسیِ SSRC، شروعِ مجدد یا اعتبارِ بستهٔ واقعی را نمی‌گیرند.

اگر هیچ دریافتِ تازه‌ای شمرده نشده، بالاترین شمارهٔ دریافت‌شده هم نمی‌تواند جلو برود. زوجی که خلافِ این شرط باشد نامعتبر است. اگر هر دو شمارنده ثابت باشند، تابع None برمی‌گرداند: برای این منبع بلوکِ گزارش نداریم. از این نبودِ مشاهده نمی‌توان فهمید فرستنده ساکت بوده یا بسته‌های بعدی نرسیده‌اند. عددِ صفر برای یک فیلدِ موجود، با نبودنِ خودِ بلوک تفاوت دارد.

برعکس، دریافتِ دیرتر یا تکراری می‌تواند received را افزایش دهد، بی‌آنکه دامنهٔ expected بزرگ‌تر شود. این حالت بلوکِ موجود با کسرِ صفر می‌سازد. ورودی‌ها اندازهٔ بسته یا ثانیه ندارند؛ واحدِ اختلاف‌ها بسته و کسرِ نمایش‌داده‌شده بی‌واحد است. زمانِ دریافت، مهلتِ پخش، تأخیرِ رفت‌وبرگشت و کیفیتِ صوت از این دو شمارنده به دست نمی‌آیند.

۳. کدِ کاملِ محاسبه و سه بایتِ علامت‌دار

قالبِ ثابت برای تفسیرِ علامت لازم است
تصویر مفهومی: قالبِ ثابت برای تفسیرِ علامت لازم است؛ بدون مقیاس عددی و مستقل از نتایج اجرای کد.

اختلافِ دو expected، انتظارِ بازه و اختلافِ دو received، دریافتِ بازه است. تفاضلِ این دو، اختلافِ اتلافِ بازه را می‌دهد. اگر مخرج صفر یا اختلاف نامثبت باشد، بایتِ کسر صفر است؛ در حالتِ مثبت، بخشِ صحیحِ حاصلِ ضربِ نسبت در ۲۵۶ ذخیره می‌شود. پیوستِ A.3 مبنای این محاسبه است. تابعِ ما تصویرِ قبلی را پنهانی تغییر نمی‌دهد؛ انتخابِ مرزِ گزارش با فراخواننده می‌ماند.

برای اختلافِ انباشته، expected جاری منهای received جاری را نگه می‌داریم. پیش از بسته‌بندی، مقدار به دو انتهای علامت‌دارِ ۲۴بیتی محدود می‌شود؛ پیوست همین کار را به‌جای گردشِ عدد توصیه می‌کند. خودِ تابعِ مستقلِ encode_signed24 اشباع نمی‌کند و عددِ خارجِ دامنه را رد می‌کند. جدا بودنِ این دو رفتار مانع می‌شود تبدیلِ قالب، بی‌خبر از فراخواننده دادهٔ نامعتبر را تغییر دهد.

طبق مستنداتِ تبدیلِ عدد و بایت در پایتون، signed نمایشِ مکملِ دو و big ترتیبِ بزرگ‌انتها را انتخاب می‌کنند. رمزگشا دقیقاً سه بایت می‌گیرد. کد، یک بایتِ کسر را کنارِ آن سه بایت می‌گذارد؛ این چهار بایت فقط فیلدهای انتخاب‌شده‌اند، نه بستهٔ کاملِ RR. سرآیند، شناسهٔ منبع، زمان‌سنج و ارسالِ شبکه پیاده نشده‌اند.

"""Offline selected RTCP loss fields, not an RTP receiver or full RR packet."""
from fractions import Fraction
import json
import platform

CAP = 1_000_000_000
MIN24, MAX24 = -(1 << 23), (1 << 23) - 1


def encode_signed24(value):
    if type(value) is not int:
        raise TypeError('signed24 value must be an exact int')
    if not MIN24 <= value <= MAX24:
        raise ValueError('signed24 value is out of range; no implicit clamp')
    return value.to_bytes(3, 'big', signed=True)


def decode_signed24(data):
    if type(data) is not bytes:
        raise TypeError('signed24 input must be exact bytes')
    if len(data) != 3:
        raise ValueError('signed24 input must contain exactly3 bytes')
    return int.from_bytes(data, 'big', signed=True)


def _snapshot(value):
    if type(value) is not tuple or len(value) != 2:
        raise TypeError('snapshot must be exact tuple(expected, received)')
    for count in value:
        if type(count) is not int:
            raise TypeError('counts must be exact ints, not bool')
        if not 0 <= count <= CAP:
            raise ValueError('own counter cap is0..1000000000')
    expected, received = value
    if (expected == 0) != (received == 0):
        raise ValueError('uninitialized snapshot is only(0,0)')
    if received == 1 and expected != 1:
        raise ValueError('a singleton first receipt has span1')
    return expected, received


def loss_fields(previous, current):
    """Same source/epoch, trusted span counters; no hidden previous-state update."""
    old_e, old_r = _snapshot(previous)
    now_e, now_r = _snapshot(current)
    expected_interval, received_interval = now_e - old_e, now_r - old_r
    if expected_interval < 0 or received_interval < 0:
        raise ValueError('counter regression/reset is outside this contract')
    if received_interval == 0:
        if expected_interval != 0:
            raise ValueError('highest received span cannot advance without arrival')
        return None
    lost_interval = expected_interval - received_interval
    fraction = (256 * lost_interval // expected_interval
                if expected_interval > 0 and lost_interval > 0 else 0)
    cumulative_raw = now_e - now_r
    cumulative = max(MIN24, min(MAX24, cumulative_raw))
    packed = bytes([fraction]) + encode_signed24(cumulative)
    return {'expected_interval': expected_interval,
            'received_interval': received_interval, 'lost_interval': lost_interval,
            'fraction_lost_byte': fraction,
            'represented_fraction': str(Fraction(fraction, 256)),
            'cumulative_raw_packets': cumulative_raw,
            'cumulative_signed24_packets': cumulative,
            'selected_four_bytes_hex': packed.hex()}


def reference_signed24(value):
    """Signed bit-weight construction; no production codec or integer byte API."""
    negative = value < 0
    remainder = value + (1 << 23) if negative else value
    bits = [int(negative)]
    for weight in [2 ** i for i in range(22, -1, -1)]:
        bit = int(remainder >= weight)
        bits.append(bit)
        if bit:
            remainder -= weight
    assert remainder == 0
    return bytes(sum(bits[start + i] * 2 ** (7 - i) for i in range(8))
                 for start in (0, 8, 16))


def reference_decode(data):
    bits = [int(c) for byte in data for c in format(byte, '08b')]
    return -bits[0] * 2 ** 23 + sum(bits[i] * 2 ** (23 - i)
                                   for i in range(1, 24))


def reference_report(previous, current):
    """Quantizer by candidate-boundary comparisons, not production division."""
    arrivals = current[1] - previous[1]
    if arrivals == 0:
        return None
    span = current[0] - previous[0]
    missing = span - arrivals
    candidates = [c for c in range(256) if c * span <= 256 * missing]
    code = max(candidates) if span > 0 and missing > 0 else 0
    raw = current[0] - current[1]
    cumulative = sorted([-(2 ** 23), raw, 2 ** 23 - 1])[1]
    return {'expected_interval': span, 'received_interval': arrivals,
            'lost_interval': missing, 'fraction_lost_byte': code,
            'represented_fraction': str(Fraction(code, 256)),
            'cumulative_raw_packets': raw,
            'cumulative_signed24_packets': cumulative,
            'selected_four_bytes_hex': format(code, '02x') + reference_signed24(cumulative).hex()}


def rejects(kind, function):
    try:
        function()
    except kind:
        return True
    return False


def self_check():
    checks = {}
    states = ((0, 0), (10, 8), (20, 19), (24, 26))
    reports = [loss_fields(a, b) for a, b in zip(states, states[1:])]
    checks['hand_reports_interval_and_cumulative_are_distinct'] = (
        [r['fraction_lost_byte'] for r in reports] == [51, 0, 0] and
        [r['cumulative_raw_packets'] for r in reports] == [2, 1, -2] and
        reports[0]['selected_four_bytes_hex'] == '33000002')
    checks['no_new_arrival_means_no_report_block_not_zero_field'] = (
        loss_fields((0, 0), (0, 0)) is None and
        loss_fields((10, 8), (10, 8)) is None)
    late = loss_fields((10, 8), (10, 9))
    checks['late_or_duplicate_only_interval_is_an_actual_zero_fraction'] = (
        late is not None and late['expected_interval'] == 0 and
        late['received_interval'] == 1 and late['fraction_lost_byte'] == 0)
    checks['duplicate_inclusive_cumulative_can_be_negative'] = (
        reports[2]['cumulative_signed24_packets'] == -2 and
        reports[2]['selected_four_bytes_hex'] == '00fffffe')
    mixed = loss_fields((10, 30), (20, 35))
    checks['positive_interval_loss_can_coexist_with_negative_cumulative'] = (
        mixed['lost_interval'] == 5 and mixed['fraction_lost_byte'] == 128 and
        mixed['cumulative_raw_packets'] == -15)
    third = loss_fields((0, 0), (3, 2))
    high = loss_fields((1, 1), (257, 2))
    checks['fixed_point_floors_and_largest_byte_is_below_one'] = (
        third['fraction_lost_byte'] == 85 and
        Fraction(third['represented_fraction']) < Fraction(1, 3) and
        high['fraction_lost_byte'] == 255 and high['represented_fraction'] == '255/256')
    vectors = [(0, '000000'), (1, '000001'), (-1, 'ffffff'), (-2, 'fffffe'),
               (MIN24, '800000'), (MAX24, '7fffff'),
               (0x123456, '123456'), (-0x12346, 'fedcba')]
    checks['signed24_directed_known_byte_vectors'] = all(
        encode_signed24(n).hex() == wire and decode_signed24(bytes.fromhex(wire)) == n
        for n, wire in vectors)
    positive = loss_fields((0, 0), (CAP, 2))
    negative = loss_fields((0, 0), (1, CAP))
    checks['cumulative_clamps_instead_of_signed24_wrap'] = (
        positive['cumulative_raw_packets'] == CAP - 2 and
        positive['cumulative_signed24_packets'] == MAX24 and
        positive['selected_four_bytes_hex'] == 'ff7fffff' and
        negative['cumulative_signed24_packets'] == MIN24 and
        negative['selected_four_bytes_hex'] == '00800000')
    checks['strict_codec_types_lengths_and_numeric_bounds'] = (
        all(rejects(TypeError, lambda n=n: encode_signed24(n)) for n in [True, 1.0, '1']) and
        all(rejects(ValueError, lambda n=n: encode_signed24(n)) for n in [MIN24 - 1, MAX24 + 1]) and
        all(rejects(TypeError, lambda x=x: decode_signed24(x))
            for x in [bytearray(3), memoryview(bytes(3)), '000', 0]) and
        all(rejects(ValueError, lambda x=x: decode_signed24(x))
            for x in [b'', bytes(2), bytes(4)]))
    checks['snapshot_container_shapes_are_explicit'] = all(
        rejects(TypeError, lambda x=x: loss_fields(x, (1, 1)))
        for x in [[0, 0], (), (0,), (0, 0, 0), {'expected': 0}, None])
    checks['counter_type_negative_and_cap_validation'] = (
        all(rejects(TypeError, lambda x=x: loss_fields((0, 0), x))
            for x in [(True, 1), (1, False), (1.0, 1), (1, '1')]) and
        all(rejects(ValueError, lambda x=x: loss_fields((0, 0), x))
            for x in [(-1, 1), (1, -1), (CAP + 1, 1), (1, CAP + 1)]))
    checks['regression_and_inconsistent_source_snapshots_rejected'] = all(
        rejects(ValueError, lambda a=a, b=b: loss_fields(a, b))
        for a, b in [((10, 8), (9, 8)), ((10, 8), (10, 7)),
                     ((10, 8), (11, 8)), ((0, 0), (0, 1)),
                     ((0, 0), (1, 0)), ((0, 0), (2, 1)), ((10, 8), (0, 0))])
    oracle_ok, oracle_cases = True, 0
    for prior in [(0, 0), (10, 7), (20, 30)]:
        for span in range(1, 49):
            for arrivals in range(1, span + 4):
                current = (prior[0] + span, prior[1] + arrivals)
                if current[1] == 1 and current[0] != 1:
                    continue
                actual = loss_fields(prior, current)
                expected = reference_report(prior, current)
                wire = bytes.fromhex(actual['selected_four_bytes_hex'])[1:]
                oracle_ok = oracle_ok and actual == expected and reference_decode(wire) == actual['cumulative_signed24_packets']
                oracle_cases += 1
    checks['independent_quantizer_and_signed_bit_weight_grid'] = oracle_ok and oracle_cases == 3913
    batches = ((1, 2, 4), (2, 5), (7, 7, 3), (), (9, 10))
    arrived, event_previous, event_codes, event_ok = [], (0, 0), [], True
    for batch in batches:
        arrived.extend(batch)
        current = (len(range(1, max(arrived) + 1)), len(arrived))
        actual = loss_fields(event_previous, current)
        event_ok = event_ok and actual == reference_report(event_previous, current)
        event_codes.append(None if actual is None else actual['fraction_lost_byte'])
        event_previous = current
    checks['independent_arrival_batches_keep_duplicates_late_and_no_arrival_separate'] = (
        event_ok and event_codes == [64, 0, 0, None, 85] and batches ==
        ((1, 2, 4), (2, 5), (7, 7, 3), (), (9, 10)))
    assert len(checks) == 14 and all(type(v) is bool for v in checks.values())
    assert all(checks.values()), checks
    return {'python': platform.python_version(), 'dependencies': 'standard library only',
            'counter_cap': CAP, 'fixture_states_expected_received': states,
            'fixture_reports': reports, 'late_only_report': late,
            'mixed_positive_interval_negative_cumulative': mixed,
            'one_third_report': third, 'near_full_loss_report': high,
            'no_arrival_report': None, 'cumulative_saturation': [positive, negative],
            'source_event_batch_fraction_bytes': event_codes,
            'independent_grid_cases': oracle_cases, 'unique_executed_checks': len(checks),
            'checks': checks, 'all_passed': all(checks.values()),
            'scope': 'Selected four loss-field bytes only; no full RR, source validator, network, RTT or audio quality claim.'}


if __name__ == '__main__':
    print(json.dumps(self_check(), ensure_ascii=True, indent=2))

۴. گزارش‌ها را با مرجعِ مستقل بسنجیم

مرجعِ مستقل به پاسخِ برنامه تکیه نمی‌کند
تصویر مفهومی: مرجعِ مستقل به پاسخِ برنامه تکیه نمی‌کند؛ بدون مقیاس عددی و مستقل از نتایج اجرای کد.

در اجرای واقعی، گزارشِ نخست بایتِ ۵۱ و اختلافِ انباشتهٔ دو داشت؛ چهار بایتِ منتخب در هگزادسیمال 33000002 شدند. ۵۱ درصد نیست: نمایشِ کسریِ آن ۵۱ تقسیم بر ۲۵۶ است. پس از رسیدن به انتظارِ ۲۴ و دریافتِ ۲۶، بایتِ کسر صفر و اختلافِ انباشته منفیِ دو شد؛ نمایشِ چهار بایت 00fffffe بود. منفی بودن را از همان سه بایت با علامت می‌خوانیم.

شاهدِ یک‌سوم، انتظارِ سه و دریافتِ دو دارد. بایتِ حاصل ۸۵ است و مقدارِ نمایش‌پذیرِ ۸۵ تقسیم بر ۲۵۶ اندکی کمتر از یک‌سوم است. در شاهدی که شمارنده‌ها از زوجِ یک و یک به انتظارِ ۲۵۷ و دریافتِ دو می‌رسند، بازه ۲۵۶ انتظار و یک دریافتِ تازه دارد. بایتِ ۲۵۵، یعنی ۲۵۵ تقسیم بر ۲۵۶، به دست می‌آید؛ آن را صددرصد نمی‌نامیم. شاهدهای سقف نیز اختلافِ خامِ بزرگ را در ۸۳۸۸۶۰۷ یا منفیِ ۸۳۸۸۶۰۸ نگه می‌دارند، بدونِ گردشِ علامت.

فایل با پایتونِ ۳٫۱۴٫۵ و کتابخانهٔ استاندارد یک بار اجرا شد؛ خطای استاندارد خالی و چهارده گروه موفق بودند. مرجعِ مستقل، بایتِ کسر را با مقایسهٔ مرزهای ضربیِ همهٔ نامزدها می‌یابد، نه تقسیمِ تابعِ اصلی. سه بایت را نیز با وزنِ بیتِ علامت و بیت‌های دیگر می‌سازد. خانوادهٔ ۳۹۱۳ مقایسه یک گروه است؛ بردارهای بایتی، مرزها، انواعِ ورودی و دسته‌های دریافت، گروه‌های جدا و مشخص دارند.

{
  "python": "3.14.5",
  "dependencies": "standard library only",
  "counter_cap": 1000000000,
  "fixture_states_expected_received": [
    [
      0,
      0
    ],
    [
      10,
      8
    ],
    [
      20,
      19
    ],
    [
      24,
      26
    ]
  ],
  "fixture_reports": [
    {
      "expected_interval": 10,
      "received_interval": 8,
      "lost_interval": 2,
      "fraction_lost_byte": 51,
      "represented_fraction": "51/256",
      "cumulative_raw_packets": 2,
      "cumulative_signed24_packets": 2,
      "selected_four_bytes_hex": "33000002"
    },
    {
      "expected_interval": 10,
      "received_interval": 11,
      "lost_interval": -1,
      "fraction_lost_byte": 0,
      "represented_fraction": "0",
      "cumulative_raw_packets": 1,
      "cumulative_signed24_packets": 1,
      "selected_four_bytes_hex": "00000001"
    },
    {
      "expected_interval": 4,
      "received_interval": 7,
      "lost_interval": -3,
      "fraction_lost_byte": 0,
      "represented_fraction": "0",
      "cumulative_raw_packets": -2,
      "cumulative_signed24_packets": -2,
      "selected_four_bytes_hex": "00fffffe"
    }
  ],
  "late_only_report": {
    "expected_interval": 0,
    "received_interval": 1,
    "lost_interval": -1,
    "fraction_lost_byte": 0,
    "represented_fraction": "0",
    "cumulative_raw_packets": 1,
    "cumulative_signed24_packets": 1,
    "selected_four_bytes_hex": "00000001"
  },
  "mixed_positive_interval_negative_cumulative": {
    "expected_interval": 10,
    "received_interval": 5,
    "lost_interval": 5,
    "fraction_lost_byte": 128,
    "represented_fraction": "1/2",
    "cumulative_raw_packets": -15,
    "cumulative_signed24_packets": -15,
    "selected_four_bytes_hex": "80fffff1"
  },
  "one_third_report": {
    "expected_interval": 3,
    "received_interval": 2,
    "lost_interval": 1,
    "fraction_lost_byte": 85,
    "represented_fraction": "85/256",
    "cumulative_raw_packets": 1,
    "cumulative_signed24_packets": 1,
    "selected_four_bytes_hex": "55000001"
  },
  "near_full_loss_report": {
    "expected_interval": 256,
    "received_interval": 1,
    "lost_interval": 255,
    "fraction_lost_byte": 255,
    "represented_fraction": "255/256",
    "cumulative_raw_packets": 255,
    "cumulative_signed24_packets": 255,
    "selected_four_bytes_hex": "ff0000ff"
  },
  "no_arrival_report": null,
  "cumulative_saturation": [
    {
      "expected_interval": 1000000000,
      "received_interval": 2,
      "lost_interval": 999999998,
      "fraction_lost_byte": 255,
      "represented_fraction": "255/256",
      "cumulative_raw_packets": 999999998,
      "cumulative_signed24_packets": 8388607,
      "selected_four_bytes_hex": "ff7fffff"
    },
    {
      "expected_interval": 1,
      "received_interval": 1000000000,
      "lost_interval": -999999999,
      "fraction_lost_byte": 0,
      "represented_fraction": "0",
      "cumulative_raw_packets": -999999999,
      "cumulative_signed24_packets": -8388608,
      "selected_four_bytes_hex": "00800000"
    }
  ],
  "source_event_batch_fraction_bytes": [
    64,
    0,
    0,
    null,
    85
  ],
  "independent_grid_cases": 3913,
  "unique_executed_checks": 14,
  "checks": {
    "hand_reports_interval_and_cumulative_are_distinct": true,
    "no_new_arrival_means_no_report_block_not_zero_field": true,
    "late_or_duplicate_only_interval_is_an_actual_zero_fraction": true,
    "duplicate_inclusive_cumulative_can_be_negative": true,
    "positive_interval_loss_can_coexist_with_negative_cumulative": true,
    "fixed_point_floors_and_largest_byte_is_below_one": true,
    "signed24_directed_known_byte_vectors": true,
    "cumulative_clamps_instead_of_signed24_wrap": true,
    "strict_codec_types_lengths_and_numeric_bounds": true,
    "snapshot_container_shapes_are_explicit": true,
    "counter_type_negative_and_cap_validation": true,
    "regression_and_inconsistent_source_snapshots_rejected": true,
    "independent_quantizer_and_signed_bit_weight_grid": true,
    "independent_arrival_batches_keep_duplicates_late_and_no_arrival_separate": true
  },
  "all_passed": true,
  "scope": "Selected four loss-field bytes only; no full RR, source validator, network, RTT or audio quality claim."
}

۵. چهار پرسش دربارهٔ تکرار، تأخیر و اشباع

نبودِ مشاهده را با عددِ صفر یکی نگیریم
تصویر مفهومی: نبودِ مشاهده را با عددِ صفر یکی نگیریم؛ بدون مقیاس عددی و مستقل از نتایج اجرای کد.

پرسشِ اول: شمارندهٔ منفی یعنی بستهٔ منفی گم شده است؟ پاسخ خیر است. در حسابِ این گزارش، دریافتِ تکراری هم شمارش می‌شود و می‌تواند received را از expected بیشتر کند. این عدد، تفاضلِ تعریف‌شدهٔ دو شمارنده است؛ شمارِ اعضای یکتای غایب یا حقیقتِ اتلافِ دائمی نیست. حتی کسرِ مثبتِ یک بازه می‌تواند کنارِ اختلافِ انباشتهٔ منفی قرار بگیرد؛ شاهدِ جداگانهٔ کد همین حالت را می‌سنجد.

پرسشِ دوم: اگر هیچ بسته‌ای نرسید، کسر را ۲۵۵ بگذاریم؟ پاسخ خیر است. مرجع می‌گوید برای منبعی که در بازه چیزی از آن دریافت نشده، بلوکِ مربوط صادر نمی‌شود. در قراردادِ ما شمارنده‌های ثابت None می‌دهند؛ جلو رفتنِ expected بدونِ دریافت خطاست. این تابع تعدادِ ارسال‌های نادیده را از ساعت یا سکوت حدس نمی‌زند و مقدارِ ساختگیِ صددرصد تولید نمی‌کند.

پرسشِ سوم: آیا رمزگذاریِ عددِ خیلی بزرگ باید دور بزند؟ پاسخ خیر است. مسیرِ گزارش، اختلافِ خام را صریحاً اشباع می‌کند و مقدارِ خام را نیز در خروجیِ آموزشی نگه می‌دارد. تبدیل‌کنندهٔ مستقل فقط دامنهٔ قابلِ نمایش را می‌پذیرد. از روی مقدارِ اشباع‌شده نمی‌توان بزرگیِ دقیقِ اختلافِ خام را بازیابی کرد؛ این اتلافِ اطلاعاتِ قالب باید هنگامِ تفسیر مشخص بماند.

پرسشِ چهارم: آیا این گزارش کیفیتِ تماس را ثابت می‌کند؟ پاسخ خیر است. کد صوت، کدک، جبرانِ حذف یا الگوی زمان‌بندی ندارد؛ صحتِ گیرندهٔ واقعی نیز آزموده نشده است. منابع در ۲۷ مهر ۱۴۰۵ خوانده شدند: RFC متعلق به ژوئیهٔ ۲۰۰۳ است و صفحهٔ پایتون نسخهٔ مستنداتِ ۳٫۱۴٫۸ را نشان می‌داد. تصاویر مفهومی‌اند و نتیجهٔ اندازه‌گیری نیستند؛ هیچ ادعای سرعت، کاراییِ محصول یا بهبودِ تماس نداریم.

منابع و مطالعهٔ بیشتر

بررسی منابع: ۲۷ مهر ۱۴۰۵. تحلیل‌ها و پیشنهادهای اجرایی، جمع‌بندی نویسنده‌اند.