diff --git a/src/transcription-filter.cpp b/src/transcription-filter.cpp index 5770352..ccf7079 100644 --- a/src/transcription-filter.cpp +++ b/src/transcription-filter.cpp @@ -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; } diff --git a/src/whisper-processing.cpp b/src/whisper-processing.cpp index 69bbfb8..be21906 100644 --- a/src/whisper-processing.cpp +++ b/src/whisper-processing.cpp @@ -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(data); const size_t segment_size = gf->frames * sizeof(float);