mirror of
https://github.com/occ-ai/obs-localvocal
synced 2024-11-07 18:57:14 +00:00
swap thread
This commit is contained in:
parent
de346a2897
commit
6ccff434f7
@ -399,10 +399,12 @@ void *transcription_filter_create(obs_data_t *settings, obs_source_t *filter)
|
||||
|
||||
obs_log(LOG_INFO, "transcription_filter: start whisper thread");
|
||||
// start the thread
|
||||
gf->whisper_thread = std::thread(whisper_loop, gf);
|
||||
std::thread new_whisper_thread(whisper_loop, gf);
|
||||
gf->whisper_thread.swap(new_whisper_thread);
|
||||
|
||||
gf->active = true;
|
||||
|
||||
obs_log(LOG_INFO, "transcription_filter: filter created.");
|
||||
return gf;
|
||||
}
|
||||
|
||||
|
@ -297,6 +297,11 @@ void process_audio_from_buffer(struct transcription_filter_data *gf)
|
||||
|
||||
void whisper_loop(void *data)
|
||||
{
|
||||
if (data == nullptr) {
|
||||
obs_log(LOG_ERROR, "whisper_loop: data is null");
|
||||
return;
|
||||
}
|
||||
|
||||
struct transcription_filter_data *gf =
|
||||
static_cast<struct transcription_filter_data *>(data);
|
||||
const size_t segment_size = gf->frames * sizeof(float);
|
||||
|
Loading…
Reference in New Issue
Block a user