Skip to content

Commit

Permalink
fix: Byte mismatch issue
Browse files Browse the repository at this point in the history
I hypothesize that this is due to a potential race condition between two
recorders when the keyboard has been destroyed while recording. When the
keyboard has been recreated, it will start a second new recorder. Since
the first recorder isn't stopped, sending a request based on the file
may lead to mismatch between file header size and actual file size,
since the file is being written to while being read.

Full error message:

```
expected X bytes but received Y
```

Note that Y will be larger than X.

Fixes: #40
  • Loading branch information
j3soon committed Nov 7, 2024
1 parent 59f0c54 commit 0750576
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,10 @@ class WhisperInputService : InputMethodService() {
recorderManager!!.stop()
}

override fun onDestroy() {
super.onDestroy()
whisperTranscriber.stop()
whisperKeyboard.reset()
recorderManager!!.stop()
}
}

0 comments on commit 0750576

Please sign in to comment.