Commit 47bd62f
committed
fix(voice): resolve native crash and Whisper encoding failure during recording
- Win32AudioCaptureService: fix race condition between StopAsync resource cleanup and WaveInCallback on the multimedia thread. Move all pointer access inside lock and set _isRecording=false before waveInReset to prevent callbacks from touching freed GCHandles/buffers.
- WhisperSpeechToTextEngine: reject audio shorter than 1s (16k samples) to avoid WhisperProcessingException from the native encoder.
Made-with: Cursor1 parent d45e9d6 commit 47bd62f
File tree
2 files changed
+22
-20
lines changed- src
- LiveLingo.Core/Speech
- LiveLingo.Desktop/Platform/Windows
2 files changed
+22
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
35 | 46 | | |
36 | 47 | | |
37 | 48 | | |
| |||
Lines changed: 11 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | 99 | | |
102 | 100 | | |
103 | 101 | | |
| |||
116 | 114 | | |
117 | 115 | | |
118 | 116 | | |
119 | | - | |
120 | | - | |
121 | 117 | | |
122 | 118 | | |
123 | | - | |
124 | | - | |
125 | | - | |
| 119 | + | |
126 | 120 | | |
127 | 121 | | |
128 | 122 | | |
| |||
141 | 135 | | |
142 | 136 | | |
143 | 137 | | |
144 | | - | |
145 | | - | |
| 138 | + | |
146 | 139 | | |
147 | | - | |
148 | | - | |
149 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
150 | 144 | | |
151 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
152 | 148 | | |
153 | 149 | | |
154 | | - | |
155 | 150 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 151 | + | |
160 | 152 | | |
161 | | - | |
162 | 153 | | |
163 | 154 | | |
164 | 155 | | |
| |||
0 commit comments