mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-10 22:05:06 +00:00
obs/source-factory: Skip broken filter rendering by default
Fixes a black screen issue if a filter happens to run into an unexpected issue which it considers unrecoverable.
This commit is contained in:
parent
5185c720ea
commit
032a3c6deb
1 changed files with 18 additions and 1 deletions
|
@ -143,7 +143,7 @@ namespace obs {
|
|||
break;
|
||||
case OBS_SOURCE_VIDEO:
|
||||
_info.video_tick = _video_tick;
|
||||
_info.video_render = _video_render;
|
||||
_info.video_render = _video_render_filter;
|
||||
break;
|
||||
}
|
||||
if ((_info.output_flags & OBS_SOURCE_AUDIO) != 0) {
|
||||
|
@ -327,6 +327,18 @@ namespace obs {
|
|||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
}
|
||||
|
||||
static void _video_render_filter(void* data, gs_effect_t* effect) noexcept
|
||||
try {
|
||||
if (data)
|
||||
reinterpret_cast<_instance*>(data)->video_render(effect);
|
||||
} catch (const std::exception& ex) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s': %s.", __FUNCTION_NAME__, ex.what());
|
||||
obs_source_skip_video_filter(reinterpret_cast<_instance*>(data)->get());
|
||||
} catch (...) {
|
||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||
obs_source_skip_video_filter(reinterpret_cast<_instance*>(data)->get());
|
||||
}
|
||||
|
||||
static struct obs_source_frame* _filter_video(void* data, struct obs_source_frame* frame) noexcept
|
||||
try {
|
||||
if (data)
|
||||
|
@ -549,6 +561,11 @@ namespace obs {
|
|||
source_instance(obs_data_t* settings, obs_source_t* source) : _self(source) {}
|
||||
virtual ~source_instance(){};
|
||||
|
||||
virtual obs_source_t* get()
|
||||
{
|
||||
return _self;
|
||||
}
|
||||
|
||||
virtual uint32_t get_width()
|
||||
{
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue