Skip to content

PLC: clean up m_audioPlc entries when audio streams go away #2738

Description

@ten9876

Follow-up from PR #2732 review (packet-loss concealment).

`PanadapterStream::m_audioPlc` is a `QMap<quint32, AudioPlcState>` keyed by VITA-49 stream id. Entries are inserted lazily when an audio packet with a new `streamId` arrives, but nothing removes them when the stream goes away (slice closes, DAX channel disconnects, etc.).

Why it doesn't bite today

The set of distinct `streamId`s a Flex radio uses is small (~8 slice audio streams + a few DAX channels), so the map maxes out at maybe 20 entries × 16 bytes = under half a kilobyte even after a long session. Practically a non-issue.

Why it's still worth fixing

  • It's a slow, monotonic leak across reconnect cycles. Disconnecting from one radio and connecting to another with different stream ids leaves the old radio's entries in the map.
  • The bound is "small but the agent didn't bother to clean up" rather than "small by design".

Suggested fix

Hook the existing audio-stream teardown path (wherever `PanadapterStream` learns about a stream going away — likely `setOwnedStreamIds` or a `streamRemoved` signal) to also `m_audioPlc.remove(streamId)`. Single-line change once the right hook is located.

Scope

One-line edit + locate the right teardown callsite. No behavior change.

🤖 Spotted by Claude reviewing PR #2732; carried forward at maintainer (KK7GWY) request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    audioAudio engine and streamingbugSomething isn't workinggood first issueGood for newcomersmaintainer-reviewRequires maintainer review before any action is takenpriority: lowLow priority

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions