source-mirror: Fix crash with audio mirroring

Fixes #23
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2018-11-07 15:29:24 +01:00
parent b87ca70796
commit 11fc32f935
1 changed files with 7 additions and 6 deletions

View File

@ -268,18 +268,18 @@ Source::Mirror::~Mirror()
if (this->m_audio_capture) { if (this->m_audio_capture) {
this->m_audio_capture.reset(); this->m_audio_capture.reset();
} }
this->m_kill_audio_thread = true;
this->m_audio_notify.notify_all();
if (this->m_audio_thread.joinable()) {
this->m_audio_thread.join();
}
if (this->m_source_texture) { if (this->m_source_texture) {
this->m_source_texture.reset(); this->m_source_texture.reset();
} }
if (this->m_scene) { if (this->m_scene) {
obs_scene_release(this->m_scene); obs_scene_release(this->m_scene);
} }
this->m_kill_audio_thread = true;
this->m_audio_notify.notify_all();
if (this->m_audio_thread.joinable()) {
this->m_audio_thread.join();
}
} }
uint32_t Source::Mirror::get_width() uint32_t Source::Mirror::get_width()
@ -318,6 +318,7 @@ void Source::Mirror::update(obs_data_t* data)
if (new_source_name != m_source_name) { if (new_source_name != m_source_name) {
if (m_scene) { if (m_scene) {
if (this->m_sceneitem) { if (this->m_sceneitem) {
this->m_audio_capture.reset();
obs_sceneitem_remove(this->m_sceneitem); obs_sceneitem_remove(this->m_sceneitem);
this->m_sceneitem = nullptr; this->m_sceneitem = nullptr;
} }