libobs: Make obs_volmeter_get_nr_channels default to 0

Defaulting to 1 means that it can't be differentiated between whether a
source really has 1 channel. Now, should a source not have any audio
(yet), this function makes it very clear that this is the case by
returning 0.
This commit is contained in:
gxalpha 2022-04-15 18:59:59 +02:00 committed by Matt Gajownik
parent 94b19960e7
commit 283f7edfd7

View File

@ -897,7 +897,7 @@ int obs_volmeter_get_nr_channels(obs_volmeter_t *volmeter)
source_nr_audio_channels = get_audio_channels(
volmeter->source->sample_info.speakers);
} else {
source_nr_audio_channels = 1;
source_nr_audio_channels = 0;
}
struct obs_audio_info audio_info;
@ -907,7 +907,7 @@ int obs_volmeter_get_nr_channels(obs_volmeter_t *volmeter)
obs_nr_audio_channels = 2;
}
return CLAMP(source_nr_audio_channels, 1, obs_nr_audio_channels);
return CLAMP(source_nr_audio_channels, 0, obs_nr_audio_channels);
}
void obs_volmeter_add_callback(obs_volmeter_t *volmeter,