From 381aa3ecd4b8729840ef13fbc3f0642171f333a0 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Tue, 2 Apr 2019 20:12:38 +0200 Subject: [PATCH] source-mirror: Correctly check for Audio and Video source Previously this would not do anything correctly, as the call to obs_source_get_flags does not return anything for most sources. Instead obs_source_get_output_flags should be used to verify that we actually have a video or audio capable source to work with. --- source/sources/source-mirror.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/sources/source-mirror.cpp b/source/sources/source-mirror.cpp index b624286e..d459c9bd 100644 --- a/source/sources/source-mirror.cpp +++ b/source/sources/source-mirror.cpp @@ -350,7 +350,7 @@ void source::mirror::mirror_instance::acquire_input(std::string source_name) this->m_source = std::move(new_source); this->m_source->events.rename += std::bind(&source::mirror::mirror_instance::on_source_rename, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); - if (m_audio_enabled) { + if ((obs_source_get_output_flags(this->m_source->get()) & OBS_SOURCE_AUDIO) != 0) { this->m_source->events.audio_data += std::bind(&source::mirror::mirror_instance::on_audio_data, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); @@ -540,7 +540,7 @@ void source::mirror::mirror_instance::video_render(gs_effect_t* effect) } // Don't bother rendering sources that aren't video. - if (obs_source_get_flags(this->m_source->get()) & OBS_SOURCE_VIDEO) { + if ((obs_source_get_output_flags(this->m_source->get()) & OBS_SOURCE_VIDEO) == 0) { return; }