Jinoh Kang (@iamahuman) commented about dlls/windows.media.speech/recognizer.c:
+ } + else if (old_paused > paused) + { + IAudioClient_Start(impl->audio_client); + TRACE("session worker resumed.\n"); + } + } + else if (status == 1) /* audio_buf_event signaled */ + { + UINT32 frames_available = 0, tmp_buf_offset = 0; + SIZE_T packet_size = frames_available * impl->capture_wfx.nBlockAlign; + + while (tmp_buf_offset < tmp_buf_size + && IAudioCaptureClient_GetBuffer(impl->capture_client, &audio_buf, &frames_available, &flags, NULL, NULL) == S_OK) + { + if (tmp_buf_offset + packet_size > tmp_buf_size) Verbose explanation (you're probably already aware of this): `packet_size` is always 0. `packet_size` should be the size for the current packet. The expression `frames_available * impl->capture_wfx.nBlockAlign` should be evalulated only after `frames_available` is assigned a meaningful value.
```suggestion:-0+0 SIZE_T packet_size = frames_available * impl->capture_wfx.nBlockAlign; if (tmp_buf_offset + packet_size > tmp_buf_size) ``` My guess is that you wanted to move `packet_size` declaration out of the loop, but while doing so, you accidentally took the initializer expression with it as well. In this case, you can say: ```suggestion:-0+0 packet_size = frames_available * impl->capture_wfx.nBlockAlign; if (tmp_buf_offset + packet_size > tmp_buf_size) ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1948#note_21761