2 * FreeRDP: A Remote Desktop Protocol Implementation
3 * Audio Output Virtual Channel
5 * Copyright 2009-2011 Jay Sorg
6 * Copyright 2010-2011 Vic Lee
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
34 #include <winpr/crt.h>
35 #include <winpr/synch.h>
36 #include <winpr/print.h>
37 #include <winpr/cmdline.h>
38 #include <winpr/sysinfo.h>
39 #include <winpr/collections.h>
41 #include <freerdp/types.h>
42 #include <freerdp/addin.h>
43 #include <freerdp/constants.h>
44 #include <winpr/stream.h>
45 #include <freerdp/utils/signal.h>
46 #include <freerdp/utils/svc_plugin.h>
48 #include "rdpsnd_main.h"
50 #define TIME_DELAY_MS 65
62 AUDIO_FORMAT* ServerFormats;
63 UINT16 NumberOfServerFormats;
65 AUDIO_FORMAT* ClientFormats;
66 UINT16 NumberOfClientFormats;
83 rdpsndDevicePlugin* device;
86 void rdpsnd_send_wave_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, BYTE cConfirmedBlockNo);
88 static void* rdpsnd_schedule_thread(void* arg)
95 rdpsndPlugin* rdpsnd = (rdpsndPlugin*) arg;
99 if (!MessageQueue_Wait(rdpsnd->queue))
102 if (!MessageQueue_Peek(rdpsnd->queue, &message, TRUE))
105 if (message.id == WMQ_QUIT)
108 wave = (RDPSND_WAVE*) message.wParam;
109 wCurrentTime = (UINT16) GetTickCount();
110 wTimeStamp = wave->wLocalTimeB;
112 if (wCurrentTime <= wTimeStamp)
114 wTimeDiff = wTimeStamp - wCurrentTime;
118 rdpsnd_send_wave_confirm_pdu(rdpsnd, wave->wTimeStampB, wave->cBlockNo);
125 void rdpsnd_send_quality_mode_pdu(rdpsndPlugin* rdpsnd)
129 pdu = Stream_New(NULL, 8);
130 Stream_Write_UINT8(pdu, SNDC_QUALITYMODE); /* msgType */
131 Stream_Write_UINT8(pdu, 0); /* bPad */
132 Stream_Write_UINT16(pdu, 4); /* BodySize */
133 Stream_Write_UINT16(pdu, HIGH_QUALITY); /* wQualityMode */
134 Stream_Write_UINT16(pdu, 0); /* Reserved */
136 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
139 void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
142 AUDIO_FORMAT* serverFormat;
143 AUDIO_FORMAT* clientFormat;
145 rdpsnd_free_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
146 rdpsnd->NumberOfClientFormats = 0;
147 rdpsnd->ClientFormats = NULL;
149 rdpsnd->ClientFormats = (AUDIO_FORMAT*) malloc(sizeof(AUDIO_FORMAT) * rdpsnd->NumberOfServerFormats);
151 for (index = 0; index < (int) rdpsnd->NumberOfServerFormats; index++)
153 serverFormat = &rdpsnd->ServerFormats[index];
155 if (rdpsnd->fixedFormat > 0 && (rdpsnd->fixedFormat != serverFormat->wFormatTag))
158 if (rdpsnd->fixedChannel > 0 && (rdpsnd->fixedChannel != serverFormat->nChannels))
161 if (rdpsnd->fixedRate > 0 && (rdpsnd->fixedRate != serverFormat->nSamplesPerSec))
164 if (rdpsnd->device && rdpsnd->device->FormatSupported(rdpsnd->device, serverFormat))
166 clientFormat = &rdpsnd->ClientFormats[rdpsnd->NumberOfClientFormats++];
168 CopyMemory(clientFormat, serverFormat, sizeof(AUDIO_FORMAT));
169 clientFormat->cbSize = 0;
171 if (serverFormat->cbSize > 0)
173 clientFormat->data = (BYTE*) malloc(serverFormat->cbSize);
174 CopyMemory(clientFormat->data, serverFormat->data, serverFormat->cbSize);
175 clientFormat->cbSize = serverFormat->cbSize;
181 fprintf(stderr, "Server ");
182 rdpsnd_print_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
183 fprintf(stderr, "\n");
185 fprintf(stderr, "Client ");
186 rdpsnd_print_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
187 fprintf(stderr, "\n");
191 void rdpsnd_send_client_audio_formats(rdpsndPlugin* rdpsnd)
198 UINT16 dwVolumeRight;
199 UINT16 wNumberOfFormats;
200 AUDIO_FORMAT* clientFormat;
202 if (rdpsnd->device->GetVolume)
204 dwVolume = rdpsnd->device->GetVolume(rdpsnd->device);
208 dwVolumeLeft = ((50 * 0xFFFF) / 100); /* 50% */
209 dwVolumeRight = ((50 * 0xFFFF) / 100); /* 50% */
210 dwVolume = (dwVolumeLeft << 16) | dwVolumeRight;
213 wNumberOfFormats = rdpsnd->NumberOfClientFormats;
217 for (index = 0; index < (int) wNumberOfFormats; index++)
218 length += (18 + rdpsnd->ClientFormats[index].cbSize);
220 pdu = Stream_New(NULL, length);
222 Stream_Write_UINT8(pdu, SNDC_FORMATS); /* msgType */
223 Stream_Write_UINT8(pdu, 0); /* bPad */
224 Stream_Write_UINT16(pdu, length - 4); /* BodySize */
226 Stream_Write_UINT32(pdu, TSSNDCAPS_ALIVE | TSSNDCAPS_VOLUME); /* dwFlags */
227 Stream_Write_UINT32(pdu, dwVolume); /* dwVolume */
228 Stream_Write_UINT32(pdu, 0); /* dwPitch */
229 Stream_Write_UINT16(pdu, 0); /* wDGramPort */
230 Stream_Write_UINT16(pdu, wNumberOfFormats); /* wNumberOfFormats */
231 Stream_Write_UINT8(pdu, 0); /* cLastBlockConfirmed */
232 Stream_Write_UINT16(pdu, 6); /* wVersion */
233 Stream_Write_UINT8(pdu, 0); /* bPad */
235 for (index = 0; index < (int) wNumberOfFormats; index++)
237 clientFormat = &rdpsnd->ClientFormats[index];
239 Stream_Write_UINT16(pdu, clientFormat->wFormatTag);
240 Stream_Write_UINT16(pdu, clientFormat->nChannels);
241 Stream_Write_UINT32(pdu, clientFormat->nSamplesPerSec);
242 Stream_Write_UINT32(pdu, clientFormat->nAvgBytesPerSec);
243 Stream_Write_UINT16(pdu, clientFormat->nBlockAlign);
244 Stream_Write_UINT16(pdu, clientFormat->wBitsPerSample);
245 Stream_Write_UINT16(pdu, clientFormat->cbSize);
247 if (clientFormat->cbSize > 0)
248 Stream_Write(pdu, clientFormat->data, clientFormat->cbSize);
251 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
254 void rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream* s)
258 AUDIO_FORMAT* format;
259 UINT16 wNumberOfFormats;
261 rdpsnd_free_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
262 rdpsnd->NumberOfServerFormats = 0;
263 rdpsnd->ServerFormats = NULL;
265 Stream_Seek_UINT32(s); /* dwFlags */
266 Stream_Seek_UINT32(s); /* dwVolume */
267 Stream_Seek_UINT32(s); /* dwPitch */
268 Stream_Seek_UINT16(s); /* wDGramPort */
269 Stream_Read_UINT16(s, wNumberOfFormats);
270 Stream_Read_UINT8(s, rdpsnd->cBlockNo); /* cLastBlockConfirmed */
271 Stream_Read_UINT16(s, wVersion); /* wVersion */
272 Stream_Seek_UINT8(s); /* bPad */
274 rdpsnd->NumberOfServerFormats = wNumberOfFormats;
275 rdpsnd->ServerFormats = (AUDIO_FORMAT*) malloc(sizeof(AUDIO_FORMAT) * wNumberOfFormats);
277 for (index = 0; index < (int) wNumberOfFormats; index++)
279 format = &rdpsnd->ServerFormats[index];
281 Stream_Read_UINT16(s, format->wFormatTag); /* wFormatTag */
282 Stream_Read_UINT16(s, format->nChannels); /* nChannels */
283 Stream_Read_UINT32(s, format->nSamplesPerSec); /* nSamplesPerSec */
284 Stream_Read_UINT32(s, format->nAvgBytesPerSec); /* nAvgBytesPerSec */
285 Stream_Read_UINT16(s, format->nBlockAlign); /* nBlockAlign */
286 Stream_Read_UINT16(s, format->wBitsPerSample); /* wBitsPerSample */
287 Stream_Read_UINT16(s, format->cbSize); /* cbSize */
289 format->data = (BYTE*) malloc(format->cbSize);
290 Stream_Read(s, format->data, format->cbSize);
293 rdpsnd_select_supported_audio_formats(rdpsnd);
295 rdpsnd_send_client_audio_formats(rdpsnd);
298 rdpsnd_send_quality_mode_pdu(rdpsnd);
301 void rdpsnd_send_training_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, UINT16 wPackSize)
305 pdu = Stream_New(NULL, 8);
306 Stream_Write_UINT8(pdu, SNDC_TRAINING); /* msgType */
307 Stream_Write_UINT8(pdu, 0); /* bPad */
308 Stream_Write_UINT16(pdu, 4); /* BodySize */
309 Stream_Write_UINT16(pdu, wTimeStamp);
310 Stream_Write_UINT16(pdu, wPackSize);
312 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
315 static void rdpsnd_recv_training_pdu(rdpsndPlugin* rdpsnd, wStream* s)
320 Stream_Read_UINT16(s, wTimeStamp);
321 Stream_Read_UINT16(s, wPackSize);
323 rdpsnd_send_training_confirm_pdu(rdpsnd, wTimeStamp, wPackSize);
326 static void rdpsnd_recv_wave_info_pdu(rdpsndPlugin* rdpsnd, wStream* s, UINT16 BodySize)
329 AUDIO_FORMAT* format;
331 rdpsnd->expectingWave = TRUE;
333 Stream_Read_UINT16(s, rdpsnd->wTimeStamp);
334 Stream_Read_UINT16(s, wFormatNo);
335 Stream_Read_UINT8(s, rdpsnd->cBlockNo);
336 Stream_Seek(s, 3); /* bPad */
337 Stream_Read(s, rdpsnd->waveData, 4);
339 rdpsnd->waveDataSize = BodySize - 8;
341 format = &rdpsnd->ClientFormats[wFormatNo];
345 rdpsnd->isOpen = TRUE;
346 rdpsnd->wCurrentFormatNo = wFormatNo;
348 //rdpsnd_print_audio_format(format);
352 IFCALL(rdpsnd->device->Open, rdpsnd->device, format, rdpsnd->latency);
355 else if (wFormatNo != rdpsnd->wCurrentFormatNo)
357 rdpsnd->wCurrentFormatNo = wFormatNo;
361 IFCALL(rdpsnd->device->SetFormat, rdpsnd->device, format, rdpsnd->latency);
366 void rdpsnd_send_wave_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, BYTE cConfirmedBlockNo)
370 pdu = Stream_New(NULL, 8);
371 Stream_Write_UINT8(pdu, SNDC_WAVECONFIRM);
372 Stream_Write_UINT8(pdu, 0);
373 Stream_Write_UINT16(pdu, 4);
374 Stream_Write_UINT16(pdu, wTimeStamp);
375 Stream_Write_UINT8(pdu, cConfirmedBlockNo); /* cConfirmedBlockNo */
376 Stream_Write_UINT8(pdu, 0); /* bPad */
378 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
381 void rdpsnd_device_send_wave_confirm_pdu(rdpsndDevicePlugin* device, RDPSND_WAVE* wave)
383 MessageQueue_Post(device->rdpsnd->queue, NULL, 0, (void*) wave, NULL);
386 static void rdpsnd_recv_wave_pdu(rdpsndPlugin* rdpsnd, wStream* s)
391 AUDIO_FORMAT* format;
393 rdpsnd->expectingWave = FALSE;
396 * The Wave PDU is a special case: it is always sent after a Wave Info PDU,
397 * and we do not process its header. Instead, the header is pad that needs
398 * to be filled with the first four bytes of the audio sample data sent as
399 * part of the preceding Wave Info PDU.
402 CopyMemory(Stream_Buffer(s), rdpsnd->waveData, 4);
404 data = Stream_Buffer(s);
405 size = Stream_Capacity(s);
407 wave = (RDPSND_WAVE*) malloc(sizeof(RDPSND_WAVE));
409 wave->wLocalTimeA = GetTickCount();
410 wave->wTimeStampA = rdpsnd->wTimeStamp;
411 wave->wFormatNo = rdpsnd->wCurrentFormatNo;
412 wave->cBlockNo = rdpsnd->cBlockNo;
417 format = &rdpsnd->ClientFormats[rdpsnd->wCurrentFormatNo];
418 wave->wAudioLength = rdpsnd_compute_audio_time_length(format, size);
423 if (rdpsnd->device->WaveDecode)
425 IFCALL(rdpsnd->device->WaveDecode, rdpsnd->device, wave);
428 if (rdpsnd->device->WavePlay)
430 IFCALL(rdpsnd->device->WavePlay, rdpsnd->device, wave);
434 IFCALL(rdpsnd->device->Play, rdpsnd->device, data, size);
437 if (!rdpsnd->device->WavePlay)
439 wave->wTimeStampB = rdpsnd->wTimeStamp + wave->wAudioLength + TIME_DELAY_MS;
440 wave->wLocalTimeB = wave->wLocalTimeA + wave->wAudioLength + TIME_DELAY_MS;
441 rdpsnd->device->WaveConfirm(rdpsnd->device, wave);
445 static void rdpsnd_recv_close_pdu(rdpsndPlugin* rdpsnd)
447 DEBUG_SVC("server closes.");
451 IFCALL(rdpsnd->device->Close, rdpsnd->device);
454 rdpsnd->isOpen = FALSE;
457 static void rdpsnd_recv_volume_pdu(rdpsndPlugin* rdpsnd, wStream* s)
461 Stream_Read_UINT32(s, dwVolume);
462 DEBUG_SVC("dwVolume 0x%X", dwVolume);
466 IFCALL(rdpsnd->device->SetVolume, rdpsnd->device, dwVolume);
470 static void rdpsnd_recv_pdu(rdpSvcPlugin* plugin, wStream* s)
474 rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
476 if (rdpsnd->expectingWave)
478 rdpsnd_recv_wave_pdu(rdpsnd, s);
479 Stream_Free(s, TRUE);
483 Stream_Read_UINT8(s, msgType); /* msgType */
484 Stream_Seek_UINT8(s); /* bPad */
485 Stream_Read_UINT16(s, BodySize);
487 //fprintf(stderr, "msgType %d BodySize %d\n", msgType, BodySize);
492 rdpsnd_recv_server_audio_formats_pdu(rdpsnd, s);
496 rdpsnd_recv_training_pdu(rdpsnd, s);
500 rdpsnd_recv_wave_info_pdu(rdpsnd, s, BodySize);
504 rdpsnd_recv_close_pdu(rdpsnd);
508 rdpsnd_recv_volume_pdu(rdpsnd, s);
512 DEBUG_WARN("unknown msgType %d", msgType);
516 Stream_Free(s, TRUE);
519 static void rdpsnd_register_device_plugin(rdpsndPlugin* rdpsnd, rdpsndDevicePlugin* device)
523 DEBUG_WARN("existing device, abort.");
527 rdpsnd->device = device;
528 device->rdpsnd = rdpsnd;
530 device->WaveConfirm = rdpsnd_device_send_wave_confirm_pdu;
533 static BOOL rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, ADDIN_ARGV* args)
535 PFREERDP_RDPSND_DEVICE_ENTRY entry;
536 FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints;
538 entry = (PFREERDP_RDPSND_DEVICE_ENTRY) freerdp_load_channel_addin_entry("rdpsnd", (LPSTR) name, NULL, 0);
543 entryPoints.rdpsnd = rdpsnd;
544 entryPoints.pRegisterRdpsndDevice = rdpsnd_register_device_plugin;
545 entryPoints.args = args;
547 if (entry(&entryPoints) != 0)
549 DEBUG_WARN("%s entry returns error.", name);
556 void rdpsnd_set_subsystem(rdpsndPlugin* rdpsnd, char* subsystem)
558 if (rdpsnd->subsystem)
559 free(rdpsnd->subsystem);
561 rdpsnd->subsystem = _strdup(subsystem);
564 void rdpsnd_set_device_name(rdpsndPlugin* rdpsnd, char* device_name)
566 if (rdpsnd->device_name)
567 free(rdpsnd->device_name);
569 rdpsnd->device_name = _strdup(device_name);
572 COMMAND_LINE_ARGUMENT_A rdpsnd_args[] =
574 { "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
575 { "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
576 { "format", COMMAND_LINE_VALUE_REQUIRED, "<format>", NULL, NULL, -1, NULL, "format" },
577 { "rate", COMMAND_LINE_VALUE_REQUIRED, "<rate>", NULL, NULL, -1, NULL, "rate" },
578 { "channel", COMMAND_LINE_VALUE_REQUIRED, "<channel>", NULL, NULL, -1, NULL, "channel" },
579 { "latency", COMMAND_LINE_VALUE_REQUIRED, "<latency>", NULL, NULL, -1, NULL, "latency" },
580 { NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
583 static void rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* args)
587 COMMAND_LINE_ARGUMENT_A* arg;
589 flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
591 status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv,
592 rdpsnd_args, flags, rdpsnd, NULL, NULL);
598 if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
601 CommandLineSwitchStart(arg)
603 CommandLineSwitchCase(arg, "sys")
605 rdpsnd_set_subsystem(rdpsnd, arg->Value);
607 CommandLineSwitchCase(arg, "dev")
609 rdpsnd_set_device_name(rdpsnd, arg->Value);
611 CommandLineSwitchCase(arg, "format")
613 rdpsnd->fixedFormat = atoi(arg->Value);
615 CommandLineSwitchCase(arg, "rate")
617 rdpsnd->fixedRate = atoi(arg->Value);
619 CommandLineSwitchCase(arg, "channel")
621 rdpsnd->fixedChannel = atoi(arg->Value);
623 CommandLineSwitchCase(arg, "latency")
625 rdpsnd->latency = atoi(arg->Value);
627 CommandLineSwitchDefault(arg)
632 CommandLineSwitchEnd(arg)
634 while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
637 static void rdpsnd_process_connect(rdpSvcPlugin* plugin)
640 rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
642 DEBUG_SVC("connecting");
644 rdpsnd->latency = -1;
645 rdpsnd->queue = MessageQueue_New();
646 rdpsnd->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) rdpsnd_schedule_thread, (void*) plugin, 0, NULL);
648 args = (ADDIN_ARGV*) plugin->channel_entry_points.pExtendedData;
651 rdpsnd_process_addin_args(rdpsnd, args);
653 if (rdpsnd->subsystem)
655 if (strcmp(rdpsnd->subsystem, "fake") == 0)
658 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
663 rdpsnd_set_subsystem(rdpsnd, "pulse");
664 rdpsnd_set_device_name(rdpsnd, "");
665 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
670 rdpsnd_set_subsystem(rdpsnd, "alsa");
671 rdpsnd_set_device_name(rdpsnd, "default");
672 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
677 rdpsnd_set_subsystem(rdpsnd, "macaudio");
678 rdpsnd_set_device_name(rdpsnd, "default");
679 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
684 rdpsnd_set_subsystem(rdpsnd, "winmm");
685 rdpsnd_set_device_name(rdpsnd, "");
686 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
691 DEBUG_WARN("no sound device.");
696 static void rdpsnd_process_event(rdpSvcPlugin* plugin, wMessage* event)
698 freerdp_event_free(event);
701 static void rdpsnd_process_terminate(rdpSvcPlugin* plugin)
703 rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
706 IFCALL(rdpsnd->device->Free, rdpsnd->device);
708 MessageQueue_PostQuit(rdpsnd->queue, 0);
709 WaitForSingleObject(rdpsnd->thread, INFINITE);
711 MessageQueue_Free(rdpsnd->queue);
712 CloseHandle(rdpsnd->thread);
714 if (rdpsnd->subsystem)
715 free(rdpsnd->subsystem);
717 if (rdpsnd->device_name)
718 free(rdpsnd->device_name);
720 rdpsnd_free_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
721 rdpsnd->NumberOfServerFormats = 0;
722 rdpsnd->ServerFormats = NULL;
724 rdpsnd_free_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
725 rdpsnd->NumberOfClientFormats = 0;
726 rdpsnd->ClientFormats = NULL;
729 /* rdpsnd is always built-in */
730 #define VirtualChannelEntry rdpsnd_VirtualChannelEntry
732 int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
736 _p = (rdpsndPlugin*) malloc(sizeof(rdpsndPlugin));
737 ZeroMemory(_p, sizeof(rdpsndPlugin));
739 _p->plugin.channel_def.options =
740 CHANNEL_OPTION_INITIALIZED |
741 CHANNEL_OPTION_ENCRYPT_RDP;
743 strcpy(_p->plugin.channel_def.name, "rdpsnd");
745 _p->plugin.connect_callback = rdpsnd_process_connect;
746 _p->plugin.receive_callback = rdpsnd_recv_pdu;
747 _p->plugin.event_callback = rdpsnd_process_event;
748 _p->plugin.terminate_callback = rdpsnd_process_terminate;
750 #if !defined(_WIN32) && !defined(ANDROID)
754 sigaddset(&mask, SIGIO);
755 pthread_sigmask(SIG_BLOCK, &mask, NULL);
759 svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);