rdpsnd: start playing immediately when a close signal received.

This commit is contained in:
Vic Lee 2011-08-15 16:58:07 +08:00
parent a122006b0e
commit a8fde1144b
3 changed files with 15 additions and 0 deletions

View File

@ -298,6 +298,16 @@ static void rdpsnd_alsa_play(rdpsndDevicePlugin* device, uint8* data, int size)
free(decoded_data);
}
static void rdpsnd_alsa_start(rdpsndDevicePlugin* device)
{
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*)device;
if (alsa->out_handle == 0)
return;
snd_pcm_start(alsa->out_handle);
}
int FreeRDPRdpsndDeviceEntry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints)
{
rdpsndAlsaPlugin* alsa;
@ -310,6 +320,7 @@ int FreeRDPRdpsndDeviceEntry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints)
alsa->device.SetFormat = rdpsnd_alsa_set_format;
alsa->device.SetVolume = rdpsnd_alsa_set_volume;
alsa->device.Play = rdpsnd_alsa_play;
alsa->device.Start = rdpsnd_alsa_start;
alsa->device.Close = rdpsnd_alsa_close;
alsa->device.Free = rdpsnd_alsa_free;

View File

@ -363,6 +363,8 @@ static void rdpsnd_process_message_wave(rdpsndPlugin* rdpsnd, STREAM* data_in)
static void rdpsnd_process_message_close(rdpsndPlugin* rdpsnd)
{
DEBUG_SVC("server closes.");
if (rdpsnd->device)
IFCALL(rdpsnd->device->Start, rdpsnd->device);
rdpsnd->close_timestamp = get_mstime() + 2000;
rdpsnd->plugin.interval_ms = 10;
}

View File

@ -41,6 +41,7 @@ typedef void (*pcOpen) (rdpsndDevicePlugin* device, rdpsndFormat* format);
typedef void (*pcSetFormat) (rdpsndDevicePlugin* device, rdpsndFormat* format);
typedef void (*pcSetVolume) (rdpsndDevicePlugin* device, uint32 value);
typedef void (*pcPlay) (rdpsndDevicePlugin* device, uint8* data, int size);
typedef void (*pcStart) (rdpsndDevicePlugin* device);
typedef void (*pcClose) (rdpsndDevicePlugin* device);
typedef void (*pcFree) (rdpsndDevicePlugin* device);
@ -51,6 +52,7 @@ struct rdpsnd_device_plugin
pcSetFormat SetFormat;
pcSetVolume SetVolume;
pcPlay Play;
pcStart Start;
pcClose Close;
pcFree Free;
};