diff --git a/constants.h b/constants.h index 4f0b2f9..05ab56a 100644 --- a/constants.h +++ b/constants.h @@ -442,6 +442,9 @@ enum RDP_INPUT_DEVICE #define RD_STATUS_CANCELLED 0xc0000120 #define RD_STATUS_DIRECTORY_NOT_EMPTY 0xc0000101 +/* RDPSND constants */ +#define TSSNDCAPS_ALIVE 0x00000001 +#define TSSNDCAPS_VOLUME 0x00000002 /* RDPDR constants */ #define RDPDR_MAX_DEVICES 0x10 diff --git a/rdesktop.c b/rdesktop.c index fef025f..5766c77 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -1098,11 +1098,8 @@ main(int argc, char *argv[]) return EX_OSERR; #ifdef WITH_RDPSND - if (g_rdpsnd) - { - if (!rdpsnd_init(rdpsnd_optarg)) - warning("Initializing sound-support failed!\n"); - } + if (!rdpsnd_init(rdpsnd_optarg)) + warning("Initializing sound-support failed!\n"); #endif if (g_lspci_enabled) diff --git a/rdpsnd.c b/rdpsnd.c index 643350a..54f1287 100644 --- a/rdpsnd.c +++ b/rdpsnd.c @@ -45,6 +45,8 @@ #define MAX_FORMATS 10 #define MAX_QUEUE 50 +extern RD_BOOL g_rdpsnd; + static VCHANNEL *rdpsnd_channel; static VCHANNEL *rdpsnddbg_channel; static struct audio_driver *drivers = NULL; @@ -255,7 +257,7 @@ rdpsnd_process_negotiate(STREAM in) rdpsnd_reset_state(); } - if (!current_driver) + if (!current_driver && g_rdpsnd) device_available = rdpsnd_auto_select(); if (current_driver && !device_available && current_driver->wave_out_open()) @@ -301,7 +303,15 @@ rdpsnd_process_negotiate(STREAM in) } out = rdpsnd_init_packet(RDPSND_NEGOTIATE | 0x200, 20 + 18 * format_count); - out_uint32_le(out, 0x00800003); /* flags */ + + uint32 flags = TSSNDCAPS_VOLUME; + + /* if sound is enabled, set snd caps to alive to enable + transmision of audio from server */ + if (g_rdpsnd) + flags |= TSSNDCAPS_ALIVE; + out_uint32_le(out, flags); /* TSSNDCAPS flags */ + out_uint32(out, 0xffffffff); /* volume */ out_uint32(out, 0); /* pitch */ out_uint16(out, 0); /* UDP port */