22#include <freerdp/config.h>
23#include <freerdp/utils/helpers.h>
33#include <winpr/cast.h>
34#include <winpr/assert.h>
35#include <winpr/stream.h>
36#include <winpr/cmdline.h>
37#include <winpr/sysinfo.h>
39#include <pulse/pulseaudio.h>
41#include <freerdp/types.h>
42#include <freerdp/codec/dsp.h>
44#include "rdpsnd_main.h"
47#define PULSE_DEFAULT_LATENCY_MS 100
51 rdpsndDevicePlugin device;
56 pa_threaded_mainloop* mainloop;
58 pa_sample_spec sample_spec;
62 time_t reconnect_delay_seconds;
63 time_t reconnect_time;
68static BOOL rdpsnd_check_pulse(rdpsndPulsePlugin* pulse, BOOL haveStream)
75 WLog_WARN(TAG,
"pulse->context=nullptr");
83 WLog_WARN(TAG,
"pulse->stream=%p", WINPR_CXX_COMPAT_CAST(
const void*, pulse->stream));
90 WLog_WARN(TAG,
"pulse->mainloop=%p", WINPR_CXX_COMPAT_CAST(
const void*, pulse->mainloop));
98static BOOL rdpsnd_pulse_format_supported(WINPR_ATTR_UNUSED rdpsndDevicePlugin* device,
101static void rdpsnd_pulse_get_sink_info(WINPR_ATTR_UNUSED pa_context* c,
const pa_sink_info* i,
102 WINPR_ATTR_UNUSED
int eol,
void* userdata)
104 UINT16 dwVolumeLeft = ((50 * 0xFFFF) / 100);
105 UINT16 dwVolumeRight = ((50 * 0xFFFF) / 100);
106 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)userdata;
109 if (!rdpsnd_check_pulse(pulse, FALSE) || !i)
112 for (uint8_t x = 0; x < i->volume.channels; x++)
114 pa_volume_t volume = i->volume.values[x];
116 if (volume >= PA_VOLUME_NORM)
117 volume = PA_VOLUME_NORM - 1;
122 dwVolumeLeft = (UINT16)volume;
126 dwVolumeRight = (UINT16)volume;
134 pulse->volume = ((UINT32)dwVolumeLeft << 16U) | dwVolumeRight;
137static void rdpsnd_pulse_context_state_callback(pa_context* context,
void* userdata)
139 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)userdata;
141 WINPR_ASSERT(context);
144 pa_context_state_t state = pa_context_get_state(context);
148 case PA_CONTEXT_READY:
149 pa_threaded_mainloop_signal(pulse->mainloop, 0);
152 case PA_CONTEXT_FAILED:
154 pa_context_unref(pulse->context);
155 pulse->context =
nullptr;
156 if (pulse->reconnect_delay_seconds >= 0)
157 pulse->reconnect_time = time(
nullptr) + pulse->reconnect_delay_seconds;
158 pa_threaded_mainloop_signal(pulse->mainloop, 0);
161 case PA_CONTEXT_TERMINATED:
162 pa_threaded_mainloop_signal(pulse->mainloop, 0);
171static BOOL rdpsnd_pulse_connect(rdpsndDevicePlugin* device)
174 pa_operation* o =
nullptr;
175 pa_context_state_t state = PA_CONTEXT_FAILED;
176 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
178 if (!rdpsnd_check_pulse(pulse, FALSE))
181 pa_threaded_mainloop_lock(pulse->mainloop);
183 if (pa_context_connect(pulse->context,
nullptr, PA_CONTEXT_NOFLAGS,
nullptr) < 0)
185 pa_threaded_mainloop_unlock(pulse->mainloop);
191 while (pulse->context)
193 state = pa_context_get_state(pulse->context);
195 if (state == PA_CONTEXT_READY)
198 if (!PA_CONTEXT_IS_GOOD(state))
203 pa_threaded_mainloop_wait(pulse->mainloop);
208 o = pa_context_get_sink_info_by_index(pulse->context, 0, rdpsnd_pulse_get_sink_info, pulse);
211 pa_operation_unref(o);
214 if (pulse->context && (state == PA_CONTEXT_READY))
221 pa_context_disconnect(pulse->context);
225 pa_threaded_mainloop_unlock(pulse->mainloop);
229static void rdpsnd_pulse_stream_success_callback(WINPR_ATTR_UNUSED pa_stream* stream,
230 WINPR_ATTR_UNUSED
int success,
void* userdata)
232 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)userdata;
234 if (!rdpsnd_check_pulse(pulse, TRUE))
237 pa_threaded_mainloop_signal(pulse->mainloop, 0);
240static void rdpsnd_pulse_wait_for_operation(rdpsndPulsePlugin* pulse, pa_operation* operation)
242 if (!rdpsnd_check_pulse(pulse, TRUE))
248 while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
250 pa_threaded_mainloop_wait(pulse->mainloop);
253 pa_operation_unref(operation);
256static void rdpsnd_pulse_stream_state_callback(pa_stream* stream,
void* userdata)
258 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)userdata;
260 WINPR_ASSERT(stream);
261 if (!rdpsnd_check_pulse(pulse, TRUE))
264 pa_stream_state_t state = pa_stream_get_state(stream);
268 case PA_STREAM_READY:
269 pa_threaded_mainloop_signal(pulse->mainloop, 0);
272 case PA_STREAM_FAILED:
273 case PA_STREAM_TERMINATED:
277 pa_stream_unref(pulse->stream);
278 pulse->stream =
nullptr;
279 pa_threaded_mainloop_signal(pulse->mainloop, 0);
287static void rdpsnd_pulse_stream_request_callback(WINPR_ATTR_UNUSED pa_stream* stream,
288 WINPR_ATTR_UNUSED
size_t length,
void* userdata)
290 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)userdata;
292 WINPR_ASSERT(stream);
293 if (!rdpsnd_check_pulse(pulse, TRUE))
296 pa_threaded_mainloop_signal(pulse->mainloop, 0);
299static void rdpsnd_pulse_close(rdpsndDevicePlugin* device)
301 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
305 if (!rdpsnd_check_pulse(pulse, FALSE))
308 pa_threaded_mainloop_lock(pulse->mainloop);
311 rdpsnd_pulse_wait_for_operation(
312 pulse, pa_stream_drain(pulse->stream, rdpsnd_pulse_stream_success_callback, pulse));
317 pa_stream_disconnect(pulse->stream);
318 pa_stream_unref(pulse->stream);
319 pulse->stream =
nullptr;
322 pa_threaded_mainloop_unlock(pulse->mainloop);
326static BOOL rdpsnd_pulse_set_format_spec(rdpsndPulsePlugin* pulse,
const AUDIO_FORMAT* format)
328 WINPR_ASSERT(format);
330 if (!rdpsnd_check_pulse(pulse, FALSE))
333 if (!rdpsnd_pulse_format_supported(&pulse->device, format))
336 pa_sample_format_t sformat = PA_SAMPLE_INVALID;
337 switch (format->wFormatTag)
339 case WAVE_FORMAT_PCM:
340 switch (format->wBitsPerSample)
343 sformat = PA_SAMPLE_U8;
347 sformat = PA_SAMPLE_S16LE;
360 const pa_sample_spec sample_spec = { .format = sformat,
361 .rate = format->nSamplesPerSec,
363 WINPR_ASSERTING_INT_CAST(uint8_t, format->nChannels) };
364 pulse->sample_spec = sample_spec;
369static BOOL rdpsnd_pulse_context_connect(rdpsndDevicePlugin* device)
371 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
375 pa_context_new(pa_threaded_mainloop_get_api(pulse->mainloop), pulse->client_name);
380 pa_context_set_state_callback(pulse->context, rdpsnd_pulse_context_state_callback, pulse);
382 return rdpsnd_pulse_connect(&pulse->device);
386static BOOL rdpsnd_pulse_open_stream(rdpsndDevicePlugin* device)
388 pa_stream_state_t state = PA_STREAM_FAILED;
389 int flags = PA_STREAM_NOFLAGS;
390 pa_buffer_attr buffer_attr = WINPR_C_ARRAY_INIT;
391 char ss[PA_SAMPLE_SPEC_SNPRINT_MAX] = WINPR_C_ARRAY_INIT;
392 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
396 if (pa_sample_spec_valid(&pulse->sample_spec) == 0)
398 pa_sample_spec_snprint(ss,
sizeof(ss), &pulse->sample_spec);
402 pa_threaded_mainloop_lock(pulse->mainloop);
405 pa_threaded_mainloop_unlock(pulse->mainloop);
406 if (pulse->reconnect_delay_seconds >= 0 && time(
nullptr) - pulse->reconnect_time >= 0)
408 if (!rdpsnd_pulse_context_connect(device))
411 pa_threaded_mainloop_lock(pulse->mainloop);
414 if (!rdpsnd_check_pulse(pulse, FALSE))
416 pa_threaded_mainloop_unlock(pulse->mainloop);
420 pulse->stream = pa_stream_new(pulse->context, pulse->stream_name, &pulse->sample_spec,
nullptr);
424 pa_threaded_mainloop_unlock(pulse->mainloop);
429 pa_stream_set_state_callback(pulse->stream, rdpsnd_pulse_stream_state_callback, pulse);
430 pa_stream_set_write_callback(pulse->stream, rdpsnd_pulse_stream_request_callback, pulse);
431 flags = PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_ADJUST_LATENCY;
437 const UINT32 ms = (pulse->latency > 0) ? pulse->latency : PULSE_DEFAULT_LATENCY_MS;
438 const size_t val = pa_usec_to_bytes(1000ULL * ms, &pulse->sample_spec);
439 buffer_attr.maxlength = UINT32_MAX;
440 buffer_attr.tlength = (val > UINT32_MAX) ? UINT32_MAX : (UINT32)val;
441 buffer_attr.prebuf = UINT32_MAX;
442 buffer_attr.minreq = UINT32_MAX;
443 buffer_attr.fragsize = UINT32_MAX;
446 pa_stream_flags_t eflags = (pa_stream_flags_t)flags;
447 if (pa_stream_connect_playback(pulse->stream, pulse->device_name, &buffer_attr, eflags,
nullptr,
450 WLog_ERR(TAG,
"error connecting playback stream");
451 pa_stream_unref(pulse->stream);
452 pulse->stream =
nullptr;
453 pa_threaded_mainloop_unlock(pulse->mainloop);
457 while (pulse->stream)
459 state = pa_stream_get_state(pulse->stream);
461 if (state == PA_STREAM_READY)
464 if (!PA_STREAM_IS_GOOD(state))
469 pa_threaded_mainloop_wait(pulse->mainloop);
472 pa_threaded_mainloop_unlock(pulse->mainloop);
474 if (state == PA_STREAM_READY)
477 rdpsnd_pulse_close(device);
482static BOOL rdpsnd_pulse_open(rdpsndDevicePlugin* device,
const AUDIO_FORMAT* format,
485 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
487 WINPR_ASSERT(format);
489 if (!rdpsnd_check_pulse(pulse, FALSE))
492 if (!rdpsnd_pulse_set_format_spec(pulse, format))
495 pulse->latency = latency;
497 return rdpsnd_pulse_open_stream(device);
500static void rdpsnd_pulse_free(rdpsndDevicePlugin* device)
502 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
507 rdpsnd_pulse_close(device);
510 pa_threaded_mainloop_stop(pulse->mainloop);
514 pa_context_disconnect(pulse->context);
515 pa_context_unref(pulse->context);
516 pulse->context =
nullptr;
521 pa_threaded_mainloop_free(pulse->mainloop);
522 pulse->mainloop =
nullptr;
525 free(pulse->device_name);
526 free(pulse->client_name);
527 free(pulse->stream_name);
532static BOOL rdpsnd_pulse_default_format(rdpsndDevicePlugin* device,
const AUDIO_FORMAT* desired,
535 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
537 if (!pulse || !defaultFormat)
540 *defaultFormat = *desired;
541 defaultFormat->data =
nullptr;
542 defaultFormat->cbSize = 0;
543 defaultFormat->wFormatTag = WAVE_FORMAT_PCM;
544 if ((defaultFormat->nChannels < 1) || (defaultFormat->nChannels > PA_CHANNELS_MAX))
545 defaultFormat->nChannels = 2;
546 if ((defaultFormat->nSamplesPerSec < 1) || (defaultFormat->nSamplesPerSec > PA_RATE_MAX))
547 defaultFormat->nSamplesPerSec = 44100;
548 if ((defaultFormat->wBitsPerSample != 8) && (defaultFormat->wBitsPerSample != 16))
549 defaultFormat->wBitsPerSample = 16;
551 defaultFormat->nBlockAlign = defaultFormat->nChannels * defaultFormat->wBitsPerSample / 8;
552 defaultFormat->nAvgBytesPerSec = defaultFormat->nBlockAlign * defaultFormat->nSamplesPerSec;
556BOOL rdpsnd_pulse_format_supported(WINPR_ATTR_UNUSED rdpsndDevicePlugin* device,
559 WINPR_ASSERT(device);
560 WINPR_ASSERT(format);
562 switch (format->wFormatTag)
564 case WAVE_FORMAT_PCM:
565 if (format->cbSize == 0 && (format->nSamplesPerSec <= PA_RATE_MAX) &&
566 (format->wBitsPerSample == 8 || format->wBitsPerSample == 16) &&
567 (format->nChannels >= 1 && format->nChannels <= PA_CHANNELS_MAX))
582static UINT32 rdpsnd_pulse_get_volume(rdpsndDevicePlugin* device)
584 pa_operation* o =
nullptr;
585 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
587 if (!pulse || !pulse->mainloop)
590 pa_threaded_mainloop_lock(pulse->mainloop);
592 if (rdpsnd_check_pulse(pulse, FALSE))
594 o = pa_context_get_sink_info_by_index(pulse->context, 0, rdpsnd_pulse_get_sink_info, pulse);
596 pa_operation_unref(o);
598 pa_threaded_mainloop_unlock(pulse->mainloop);
599 return pulse->volume;
602static void rdpsnd_set_volume_success_cb(WINPR_ATTR_UNUSED pa_context* c,
int success,
605 rdpsndPulsePlugin* pulse = userdata;
607 if (!rdpsnd_check_pulse(pulse, TRUE))
611 WLog_INFO(TAG,
"%d", success);
615static BOOL rdpsnd_pulse_set_volume(rdpsndDevicePlugin* device, UINT32 value)
617 pa_cvolume cv = WINPR_C_ARRAY_INIT;
618 pa_volume_t left = 0;
619 pa_volume_t right = 0;
620 pa_operation* operation =
nullptr;
621 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
623 if (!pulse || !pulse->mainloop)
625 WLog_WARN(TAG,
"called before pulse backend was initialized");
629 left = (pa_volume_t)(value & 0xFFFF);
630 right = (pa_volume_t)((value >> 16) & 0xFFFF);
631 pa_cvolume_init(&cv);
633 cv.values[0] = PA_VOLUME_MUTED + (left * (PA_VOLUME_NORM - PA_VOLUME_MUTED)) / PA_VOLUME_NORM;
634 cv.values[1] = PA_VOLUME_MUTED + (right * (PA_VOLUME_NORM - PA_VOLUME_MUTED)) / PA_VOLUME_NORM;
635 pa_threaded_mainloop_lock(pulse->mainloop);
639 if (!rdpsnd_check_pulse(pulse, TRUE))
641 pa_threaded_mainloop_unlock(pulse->mainloop);
642 WLog_WARN(TAG,
"no pulse stream, not setting volume");
646 operation = pa_context_set_sink_input_volume(pulse->context, pa_stream_get_index(pulse->stream),
647 &cv, rdpsnd_set_volume_success_cb, pulse);
650 pa_operation_unref(operation);
652 pa_threaded_mainloop_unlock(pulse->mainloop);
658static BOOL rdpsnd_pulse_write(rdpsndPulsePlugin* pulse,
const BYTE* data,
size_t size)
660 const size_t frame_size = pa_frame_size(&pulse->sample_spec);
665 size -= size % frame_size;
669 size_t length = size;
670 void* pa_data =
nullptr;
672 if (pa_stream_begin_write(pulse->stream, &pa_data, &length) < 0)
685 if (!pa_data || (length == 0))
688 pa_stream_cancel_write(pulse->stream);
689 WLog_DBG(TAG,
"dropping %" PRIuz
" bytes, no buffer space", size);
694 memcpy(pa_data, data, length);
696 memset(pa_data, (pulse->sample_spec.format == PA_SAMPLE_U8) ? 0x80 : 0, length);
701 if (pa_stream_write(pulse->stream, pa_data, length,
nullptr, 0LL, PA_SEEK_RELATIVE) < 0)
703 pa_stream_cancel_write(pulse->stream);
719static BOOL rdpsnd_pulse_ran_dry(rdpsndPulsePlugin* pulse, UINT64 now)
721 if (now < pulse->play_end)
724 const pa_timing_info* ti = pa_stream_get_timing_info(pulse->stream);
725 if (!ti || ti->write_index_corrupt || ti->read_index_corrupt)
728 int64_t queued = ti->write_index - ti->read_index;
732 const pa_usec_t age = pa_timeval_age(&ti->timestamp);
733 queued -= (int64_t)pa_usec_to_bytes(age, &pulse->sample_spec);
737 if (queued <= (int64_t)pa_usec_to_bytes(20000ULL, &pulse->sample_spec))
741 pulse->play_end = now + pa_bytes_to_usec((uint64_t)queued, &pulse->sample_spec) / 1000ULL;
746static UINT rdpsnd_pulse_play(rdpsndDevicePlugin* device,
const BYTE* data,
size_t size)
748 pa_usec_t latency = 0;
750 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
755 pa_threaded_mainloop_lock(pulse->mainloop);
757 if (!rdpsnd_check_pulse(pulse, TRUE))
759 pa_threaded_mainloop_unlock(pulse->mainloop);
761 WLog_DBG(TAG,
"reconnecting playback stream");
762 if (!rdpsnd_pulse_open_stream(device))
763 WLog_WARN(TAG,
"Failed to (re)open pulse stream, ignoring playback");
772 const UINT64 now = GetTickCount64();
773 if (rdpsnd_pulse_ran_dry(pulse, now))
775 const UINT32 ms = (pulse->latency > 0) ? pulse->latency : PULSE_DEFAULT_LATENCY_MS;
776 if (!rdpsnd_pulse_write(pulse,
nullptr,
777 pa_usec_to_bytes(1000ULL * ms, &pulse->sample_spec)))
778 WLog_WARN(TAG,
"rdpsnd_pulse_write failed");
779 pulse->play_end = now + ms;
782 if (rdpsnd_pulse_write(pulse, data, size))
783 pulse->play_end += pa_bytes_to_usec(size, &pulse->sample_spec) / 1000;
785 if (pa_stream_get_latency(pulse->stream, &latency, &negative) != 0)
788 pa_threaded_mainloop_unlock(pulse->mainloop);
790 const pa_usec_t val = latency / 1000;
791 if (val > UINT32_MAX)
797static UINT rdpsnd_pulse_parse_addin_args(rdpsndPulsePlugin* pulse,
const ADDIN_ARGV* args)
800 {
"dev", COMMAND_LINE_VALUE_REQUIRED,
"<device>",
nullptr,
nullptr, -1,
nullptr,
"device" },
801 {
"reconnect_delay_seconds", COMMAND_LINE_VALUE_REQUIRED,
"<reconnect_delay_seconds>",
802 nullptr,
nullptr, -1,
nullptr,
"reconnect_delay_seconds" },
803 {
"client_name", COMMAND_LINE_VALUE_REQUIRED,
"<client_name>",
nullptr,
nullptr, -1,
804 nullptr,
"name of pulse client" },
805 {
"stream_name", COMMAND_LINE_VALUE_REQUIRED,
"<stream_name>",
nullptr,
nullptr, -1,
806 nullptr,
"name of pulse stream" },
807 {
nullptr, 0,
nullptr,
nullptr,
nullptr, -1,
nullptr,
nullptr }
810 COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
815 const int status = CommandLineParseArgumentsA(args->argc, args->argv, rdpsnd_pulse_args, flags,
816 pulse,
nullptr,
nullptr);
819 return ERROR_INVALID_DATA;
823 const char* client_name =
nullptr;
824 const char* stream_name =
nullptr;
827 if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
830 CommandLineSwitchStart(arg) CommandLineSwitchCase(arg,
"dev")
832 pulse->device_name = _strdup(arg->Value);
834 if (!pulse->device_name)
835 return ERROR_OUTOFMEMORY;
837 CommandLineSwitchCase(arg,
"reconnect_delay_seconds")
839 unsigned long val = strtoul(arg->Value,
nullptr, 0);
841 if ((errno != 0) || (val > INT32_MAX))
842 return ERROR_INVALID_DATA;
844 pulse->reconnect_delay_seconds = (time_t)val;
846 CommandLineSwitchCase(arg,
"client_name")
848 client_name = arg->Value;
850 CommandLineSwitchCase(arg,
"stream_name")
852 stream_name = arg->Value;
854 CommandLineSwitchEnd(arg)
855 }
while ((arg = CommandLineFindNextArgumentA(arg)) !=
nullptr);
858 client_name = freerdp_getApplicationDetailsString();
860 stream_name = freerdp_getApplicationDetailsString();
862 pulse->client_name = _strdup(client_name);
863 pulse->stream_name = _strdup(stream_name);
864 if (!pulse->client_name || !pulse->stream_name)
865 return ERROR_OUTOFMEMORY;
866 return CHANNEL_RC_OK;
869FREERDP_ENTRY_POINT(UINT VCAPITYPE pulse_freerdp_rdpsnd_client_subsystem_entry(
872 WINPR_ASSERT(pEntryPoints);
874 rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)calloc(1,
sizeof(rdpsndPulsePlugin));
877 return CHANNEL_RC_NO_MEMORY;
879 pulse->device.Open = rdpsnd_pulse_open;
880 pulse->device.FormatSupported = rdpsnd_pulse_format_supported;
881 pulse->device.GetVolume = rdpsnd_pulse_get_volume;
882 pulse->device.SetVolume = rdpsnd_pulse_set_volume;
883 pulse->device.Play = rdpsnd_pulse_play;
884 pulse->device.Close = rdpsnd_pulse_close;
885 pulse->device.Free = rdpsnd_pulse_free;
886 pulse->device.DefaultFormat = rdpsnd_pulse_default_format;
889 UINT ret = rdpsnd_pulse_parse_addin_args(pulse, args);
891 if (ret != CHANNEL_RC_OK)
893 WLog_ERR(TAG,
"error parsing arguments");
897 pulse->reconnect_delay_seconds = 5;
898 pulse->reconnect_time = time(
nullptr);
900 ret = CHANNEL_RC_NO_MEMORY;
901 pulse->mainloop = pa_threaded_mainloop_new();
903 if (!pulse->mainloop)
906 pa_threaded_mainloop_lock(pulse->mainloop);
908 if (pa_threaded_mainloop_start(pulse->mainloop) < 0)
910 pa_threaded_mainloop_unlock(pulse->mainloop);
914 pa_threaded_mainloop_unlock(pulse->mainloop);
916 if (!rdpsnd_pulse_context_connect((rdpsndDevicePlugin*)pulse))
919 pEntryPoints->pRegisterRdpsndDevice(pEntryPoints->rdpsnd, (rdpsndDevicePlugin*)pulse);
920 return CHANNEL_RC_OK;
922 rdpsnd_pulse_free((rdpsndDevicePlugin*)pulse);