libobs: Keep transition reference counter
The reason to keep a reference counter for transitions is due to an optimization I'm planning on when calculating transition volumes. I'm planning on walking the source tree to be able to calculate the current base volume of a source, but *only* if there are transitions active, because the only time that the volume can be anything other than 1.0 or 0.0 is when there are active transitions, which may change the base volume of a source.
This commit is contained in:
parent
6eab6ceff5
commit
10f8988667
@ -198,6 +198,8 @@ struct obs_core_data {
|
||||
|
||||
struct obs_view main_view;
|
||||
|
||||
volatile long active_transitions;
|
||||
|
||||
long long unnamed_index;
|
||||
|
||||
volatile bool valid;
|
||||
|
@ -189,6 +189,9 @@ obs_source_t *obs_source_create(enum obs_source_type type, const char *id,
|
||||
|
||||
blog(LOG_INFO, "source '%s' (%s) created", name, id);
|
||||
obs_source_dosignal(source, "source_create", NULL);
|
||||
|
||||
if (info->type == OBS_SOURCE_TYPE_TRANSITION)
|
||||
os_atomic_inc_long(&obs->data.active_transitions);
|
||||
return source;
|
||||
|
||||
fail:
|
||||
@ -223,6 +226,9 @@ void obs_source_destroy(struct obs_source *source)
|
||||
if (!source)
|
||||
return;
|
||||
|
||||
if (source->info.type == OBS_SOURCE_TYPE_TRANSITION)
|
||||
os_atomic_dec_long(&obs->data.active_transitions);
|
||||
|
||||
obs_context_data_remove(&source->context);
|
||||
|
||||
blog(LOG_INFO, "source '%s' destroyed", source->context.name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user