Files
LocalAI/core
Ettore Di Giacinto e1c06465bd fix(realtime): resolve platform opus codec backend by alias (#9813)
The realtime WebRTC transport hardcoded loading the literal "opus" backend.
On darwin/arm64 the only installable opus codec is "metal-opus" (it shares
the gallery alias "opus"). Backend names resolve through the model loader's
external-backends map, and the "opus" alias key is only registered when a
user-path variant's alias was collected; a system-path metal-opus registers
only under its concrete name. As a result, with metal-opus installed the
realtime path still failed with "opus backend not available".

Resolve the opus codec from the set of currently loadable backends instead
of the hardcoded literal: an exact "opus" match wins (covers the plain
backend and the alias key), otherwise fall back to a platform-appropriate
"*opus*" codec, preferring the metal build on darwin/arm64. Behavior is
unchanged when a plain "opus" backend is present, and the same error is
surfaced when no opus codec is installed at all.

The selection logic is extracted into resolveOpusBackend and unit-tested.

Assisted-by: claude:claude-opus-4-8 [Claude Code]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-06-12 22:13:48 +00:00
..
2026-03-30 00:47:27 +02:00