From c7e83518e1146735e139c3941ecc817a20bcc995 Mon Sep 17 00:00:00 2001 From: Richard Stanway Date: Tue, 17 May 2022 02:32:07 +0200 Subject: [PATCH] win-wasapi: Log source name when showing device errors Sometimes users have a forgotten source pointing to an invalid device, which is very difficult to locate without us showing the source name. --- plugins/win-wasapi/win-wasapi.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/plugins/win-wasapi/win-wasapi.cpp b/plugins/win-wasapi/win-wasapi.cpp index 46b7d1939..66e6df8f6 100644 --- a/plugins/win-wasapi/win-wasapi.cpp +++ b/plugins/win-wasapi/win-wasapi.cpp @@ -871,8 +871,10 @@ DWORD WINAPI WASAPISource::CaptureThread(LPVOID param) sigs = active_sigs; } else { blog(LOG_INFO, - "WASAPI: Device '%s' failed to start", - source->device_id.c_str()); + "WASAPI: Device '%s' failed to start (source: %s)", + source->device_id.c_str(), + obs_source_get_name( + source->source)); stop = true; reconnect = true; source->reconnectDuration = @@ -882,9 +884,10 @@ DWORD WINAPI WASAPISource::CaptureThread(LPVOID param) stop = !source->ProcessCaptureData(); if (stop) { blog(LOG_INFO, - "Device '%s' invalidated. Retrying", - source->device_name - .c_str()); + "Device '%s' invalidated. Retrying (source: %s)", + source->device_name.c_str(), + obs_source_get_name( + source->source)); stop = true; reconnect = true; source->reconnectDuration = @@ -916,8 +919,10 @@ DWORD WINAPI WASAPISource::CaptureThread(LPVOID param) if (idle) { SetEvent(source->idleSignal); } else if (reconnect) { - blog(LOG_INFO, "Device '%s' invalidated. Retrying", - source->device_name.c_str()); + blog(LOG_INFO, + "Device '%s' invalidated. Retrying (source: %s)", + source->device_name.c_str(), + obs_source_get_name(source->source)); SetEvent(source->reconnectSignal); } } @@ -969,8 +974,9 @@ void WASAPISource::OnStartCapture() assert(ret == WAIT_TIMEOUT); if (!TryInitialize()) { - blog(LOG_INFO, "WASAPI: Device '%s' failed to start", - device_id.c_str()); + blog(LOG_INFO, + "WASAPI: Device '%s' failed to start (source: %s)", + device_id.c_str(), obs_source_get_name(source)); reconnectDuration = RECONNECT_INTERVAL; SetEvent(reconnectSignal); } @@ -1022,8 +1028,9 @@ void WASAPISource::OnSampleReady() client.Clear(); if (reconnect) { - blog(LOG_INFO, "Device '%s' invalidated. Retrying", - device_name.c_str()); + blog(LOG_INFO, + "Device '%s' invalidated. Retrying (source: %s)", + device_name.c_str(), obs_source_get_name(source)); SetEvent(reconnectSignal); } else { SetEvent(idleSignal);