Commit e1c0646
committed
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>1 parent 51f4f67 commit e1c0646
2 files changed
Lines changed: 95 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
14 | 62 | | |
15 | 63 | | |
16 | 64 | | |
| |||
94 | 142 | | |
95 | 143 | | |
96 | 144 | | |
97 | | - | |
98 | | - | |
99 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
100 | 158 | | |
101 | | - | |
| 159 | + | |
102 | 160 | | |
103 | 161 | | |
104 | 162 | | |
105 | | - | |
| 163 | + | |
106 | 164 | | |
107 | 165 | | |
108 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments