Merge pull request #5806 from mfleisz/fix_no_audio_device_handling

Fix audio channel init when no audio devices are present
This commit is contained in:
Martin Fleisz 2019-12-30 14:47:45 +01:00 committed by GitHub
commit 483d09b760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 4 deletions

View File

@ -1061,13 +1061,19 @@ UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
}
if (audin->device == NULL)
{
/* If we have no audin device do not register plugin but still return OK or the client will
* just disconnect due to a missing microphone. */
WLog_Print(audin->log, WLOG_ERROR, "no sound device.");
error = CHANNEL_RC_OK;
goto out;
}
error = pEntryPoints->RegisterPlugin(pEntryPoints, "audin", (IWTSPlugin*)audin);
if (error == CHANNEL_RC_OK)
return error;
out:
if (error != CHANNEL_RC_OK)
audin_plugin_terminated((IWTSPlugin*)audin);
audin_plugin_terminated((IWTSPlugin*)audin);
return error;
}

View File

@ -463,6 +463,10 @@ UINT freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEn
ADDIN_ARGV* args;
AudinWinmmDevice* winmm;
UINT error;
if (waveInGetNumDevs() == 0)
return ERROR_DEVICE_NOT_AVAILABLE;
winmm = (AudinWinmmDevice*)calloc(1, sizeof(AudinWinmmDevice));
if (!winmm)

View File

@ -308,6 +308,9 @@ UINT freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS p
if (!winmm)
return CHANNEL_RC_NO_MEMORY;
if (waveOutGetNumDevs() == 0)
return ERROR_DEVICE_NOT_AVAILABLE;
winmm->device.Open = rdpsnd_winmm_open;
winmm->device.FormatSupported = rdpsnd_winmm_format_supported;
winmm->device.GetVolume = rdpsnd_winmm_get_volume;