Skip to content

fix(audio): handle empty SoundLevelMeter blocks without NaN #4519

Closed

Description

@zackees

Context

SoundLevelMeter::processBlock divides accumulated power by count without checking zero. processBlock(nullptr, 0) computes 0/0 and leaves the current dBFS/SPL reading NaN. The public pointer and span paths both admit an empty block.

Proposal

Define empty input as a no-op (or another documented finite behavior) before the division.

Acceptance criteria

  • Add a focused RED→GREEN test for an empty block on a fresh meter and after a valid block.
  • Empty input never creates NaN and does not discard the previous valid reading.

Decisions

  • Track separately from first-block smoothing: this is a missing count guard with a different trigger and fix.
  • Priority: medium; empty blocks are plausible at stream boundaries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions