Skip to content

namir-clap: latency change causes an unbounded activate/restart loop #93

Description

@ErwanLegrand

crates/namir-clap/src/main_thread.rs:81, src/audio.rs:163-178

Every activate() builds a default engine, announces its latency (0), and dispatches spawn_recall to reload the model asynchronously. When the recalled model engages D-9.2's resampler, publish_latency (audio.rs:105) sees the change, flags dirty and requests a callback; on_main_thread finds active == true and calls request_restart(). The restart deactivates and reactivates, producing another default engine at latency 0, another recall, another change, another restart -- indefinitely, for as long as a rate-mismatched model is loaded.

tests/clap_host_latency.rs walks precisely this path and sidesteps the loop: at limb 3 it deactivates (:400-401) before servicing the second callback, so the active branch is never re-entered.

Fix: keep the last-reported-to-host latency in SharedInner across activations and skip request_restart when the new reading equals it -- or defer activate()'s announcement until the recall has converged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions