mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-29 11:01:23 +00:00
obs-source: Don't un/register audio capture with no source
Fixes the log spam if a source could not be found.
This commit is contained in:
parent
8bb1ca50ac
commit
c46e881697
1 changed files with 10 additions and 4 deletions
|
@ -440,10 +440,16 @@ obs::source::source()
|
|||
// libOBS unfortunately does not use the event system for audio data callbacks, which is kind of odd as most other
|
||||
// things do. So instead we'll have to manually deal with it for now.
|
||||
{
|
||||
this->events.audio_data.set_listen_callback(
|
||||
[this] { obs_source_add_audio_capture_callback(this->self, obs::source::handle_audio_data, this); });
|
||||
this->events.audio_data.set_silence_callback(
|
||||
[this] { obs_source_remove_audio_capture_callback(this->self, obs::source::handle_audio_data, this); });
|
||||
this->events.audio_data.set_listen_callback([this] {
|
||||
if (!this->self)
|
||||
return;
|
||||
obs_source_add_audio_capture_callback(this->self, obs::source::handle_audio_data, this);
|
||||
});
|
||||
this->events.audio_data.set_silence_callback([this] {
|
||||
if (!this->self)
|
||||
return;
|
||||
obs_source_remove_audio_capture_callback(this->self, obs::source::handle_audio_data, this);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue