source-mirror: Fix freeze introduced in OBS Studio v25.x

For an unknown reason, OBS Studio v25.x now causes a freeze to happen at this location. This should hopefully work around that issue by ensuring that we are in a location that does not cause an unusual lock order.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-03-21 09:13:31 +01:00
parent b54e9431c0
commit 03bee0aaf2
2 changed files with 10 additions and 3 deletions

View file

@ -85,12 +85,12 @@ mirror::mirror_instance::~mirror_instance()
uint32_t mirror::mirror_instance::get_width()
{
return obs_source_get_width(_source.get());
return _source_size.first;
}
uint32_t mirror::mirror_instance::get_height()
{
return obs_source_get_height(_source.get());
return _source_size.second;
}
static void convert_config(obs_data_t* data)
@ -135,7 +135,13 @@ void mirror::mirror_instance::save(obs_data_t* data)
}
}
void mirror::mirror_instance::video_tick(float time) {}
void mirror::mirror_instance::video_tick(float time)
{
if (_source) {
_source_size.first = obs_source_get_width(_source.get());
_source_size.second = obs_source_get_height(_source.get());
}
}
void mirror::mirror_instance::video_render(gs_effect_t* effect)
{

View file

@ -57,6 +57,7 @@ namespace source::mirror {
std::shared_ptr<obs::tools::child_source> _source_child;
std::shared_ptr<obs::source_signal_handler> _signal_rename;
std::shared_ptr<obs::audio_signal_handler> _signal_audio;
std::pair<uint32_t, uint32_t> _source_size;
// Audio
bool _audio_enabled;