Added some sanity checks for no sink being detected.

This commit is contained in:
Michael Rogers
2022-07-02 19:22:05 -05:00
parent 6000b85b1a
commit d4a4096bba
2 changed files with 23 additions and 12 deletions

View File

@@ -162,8 +162,14 @@ void capture(safe::mail_t mail, config_t config, void *channel_data) {
if(!ref->sink_flag->exchange(true, std::memory_order_acquire)) {
ref->restore_sink = !config.flags[config_t::HOST_AUDIO];
// If the sink is empty (Host has no sink!), definately switch to the virtual.
if (ref->sink.host.empty()) {
if (control->set_sink(*sink)) {
return;
}
}
// If the client requests audio on the host, don't change the default sink
if(!config.flags[config_t::HOST_AUDIO] && control->set_sink(*sink)) {
else if(!config.flags[config_t::HOST_AUDIO] && control->set_sink(*sink)) {
return;
}
}