win-wasapi: Prevent repeating connect fail message
Fixes an issue where if the device can't be connected, it will continually repeat the connection failure message.
This commit is contained in:
parent
f3069e3ea5
commit
1143b1d631
1 changed files with 8 additions and 0 deletions
|
|
@ -31,6 +31,7 @@ class WASAPISource {
|
|||
bool isDefaultDevice = false;
|
||||
|
||||
bool reconnecting = false;
|
||||
bool previouslyFailed = false;
|
||||
WinHandle reconnectThread;
|
||||
|
||||
bool active = false;
|
||||
|
|
@ -271,18 +272,25 @@ bool WASAPISource::TryInitialize()
|
|||
Initialize();
|
||||
|
||||
} catch (HRError error) {
|
||||
if (previouslyFailed)
|
||||
return active;
|
||||
|
||||
blog(LOG_WARNING, "[WASAPISource::TryInitialize]:[%s] %s: %lX",
|
||||
device_name.empty() ?
|
||||
device_id.c_str() : device_name.c_str(),
|
||||
error.str, error.hr);
|
||||
|
||||
} catch (const char *error) {
|
||||
if (previouslyFailed)
|
||||
return active;
|
||||
|
||||
blog(LOG_WARNING, "[WASAPISource::TryInitialize]:[%s] %s",
|
||||
device_name.empty() ?
|
||||
device_id.c_str() : device_name.c_str(),
|
||||
error);
|
||||
}
|
||||
|
||||
previouslyFailed = !active;
|
||||
return active;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue