handle missing audio-drivers better

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1270 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Michael Gernoth 2006-09-18 21:42:50 +00:00
parent 1ee09f6688
commit 162bc366b3
2 changed files with 30 additions and 15 deletions

View File

@ -690,12 +690,15 @@ main(int argc, char *argv[])
} }
} }
g_rdpsnd = True;
if (!rdpsnd_select_driver if (!rdpsnd_select_driver
(driver, options)) (driver, options))
{ {
warning("Driver not available\n"); warning("Driver not available\n");
} }
else
{
g_rdpsnd = True;
}
} }
#else #else
@ -715,11 +718,14 @@ main(int argc, char *argv[])
else else
{ {
#ifdef WITH_RDPSND #ifdef WITH_RDPSND
g_rdpsnd = True;
if (!rdpsnd_select_driver(NULL, NULL)) if (!rdpsnd_select_driver(NULL, NULL))
{ {
warning("No sound-driver available\n"); warning("No sound-driver available\n");
} }
else
{
g_rdpsnd = True;
}
#else #else
warning("Not compiled with sound support\n"); warning("Not compiled with sound support\n");
#endif #endif

View File

@ -289,20 +289,29 @@ rdpsnd_init(void)
BOOL BOOL
rdpsnd_auto_open(void) rdpsnd_auto_open(void)
{ {
current_driver = drivers; static BOOL failed = False;
while (current_driver != NULL)
{
DEBUG(("trying %s...\n", current_driver->name));
if (current_driver->wave_out_open())
{
DEBUG(("selected %s\n", current_driver->name));
return True;
}
g_dsp_fd = 0;
current_driver = current_driver->next;
}
warning("no working audio-driver found\n"); if (!failed)
{
struct audio_driver *auto_driver = current_driver;
current_driver = drivers;
while (current_driver != NULL)
{
DEBUG(("trying %s...\n", current_driver->name));
if (current_driver->wave_out_open())
{
DEBUG(("selected %s\n", current_driver->name));
return True;
}
g_dsp_fd = 0;
current_driver = current_driver->next;
}
warning("no working audio-driver found\n");
failed = True;
current_driver = auto_driver;
}
return False; return False;
} }