Commit Graph

560 Commits

Author SHA1 Message Date
Armin Novak
413dcd3c28 Fixed RDPSND_CHANNEL_NAME
RDPSND channel is special, as it has many names.
(e.g. static channel, dynamic channel and UDP one.
Use RDPSND_CHANNEL_NAME to identify the module name instad of
RDPSND_DVC_CHANNEL_NAME
2021-08-25 13:40:47 +02:00
Armin Novak
054f0ea260 Use defines instad of channel names 2021-08-25 10:54:24 +02:00
Armin Novak
5afa592244 Fixed cast-qual warnings 2021-08-24 11:10:51 +02:00
Hans-Peter Jansen
297f965052 Fix linking, if BUILTIN_CHANNELS switched off
If -DBUILTIN_CHANNELS=OFF is supplied to cmake, auxiliary channel modules
are built as plugins, that are loaded from $LIBDIR/freerdp as shared libs.

This patch fixes the linkage of these plugins by taking inter-channel dependencies
of this separation into account. If BUILTIN_CHANNELS=ON, these channel modules
are linked directly into the main modules. Therefore, the linking of the plugins
is conditioned accordingly.
2021-08-24 08:43:01 +02:00
Simon Nivault
e42696bb2e
Some fixes for audin redirection (#7231)
* Fixed research for native PCM format

* Fixed compatibility detection for resampling

* dsp: Makes channel mix and encoding process use separated buffers

* Give FramesPerPacket to freerdp_dsp_context_reset function

* dsp: Fix DVI_ADPCM codec by respecting the required packet size

* Forbid mono channel in macos

* Fix audin command line channel option

* Disable ADPCM codec as it does not work

* Refactor valid native codec research

* Native codec research: Try different channels number

* Fix dsp channel mix

* Fix dsp resample
2021-08-23 14:49:28 +02:00
Martin Fleisz
8c0cf7cd4b rdpsnd: Fix double frees in rdpsnd context cleanup 2021-07-07 11:10:04 +02:00
Armin Novak
c4c5847f81 channels: Fixed warnings, added assertions 2021-06-18 11:32:16 +02:00
Armin Novak
5fb59a23a9 Fixed lots of compilation warnings and type mismatches 2021-06-16 15:21:56 +02:00
Armin Novak
d36d94766e Replaced assert with WINPR_ASSERT 2021-06-14 09:37:07 +02:00
akallabeth
bb6c1ed8a4
Fixed #6882: Use default output device on mac (#6893) 2021-03-12 11:17:37 +01:00
Denis
8ba1dc49da fix formating with clang-format 2021-03-08 13:11:50 +01:00
Denis
b3a2042103 Add support for OpenBSD sndio 2021-03-08 13:11:50 +01:00
sss
6574fdf6e4 reverted changes from clang-format 2021-02-25 14:05:40 +01:00
Gluzskiy Alexandr
bee2e1526d allow to use in single threaded mode
(some client side channels and all server side channels still need to be
ported to new api)

server: build fix, do not disable threads for rfx encoder

cliprdr client channel: implemented support for DisableThreads option
looks like thread does not make sense at all for this channel

do not initialize disabled image codecs (respect settings)

channels: client: rail: added support for DisableThreads setting

changed "BOOL DisableThreads" to "UINT32 ThreadingFlags"
dropped unnecessary apu changes

draft implementation of threading settings aware message handling api
for addins/channels

rail: use new messaging api

fixed memory leak

msgs handlers external api changes (as requested)

msgs_handlers: init fix

fixed memory leak

logic fix

resolved problems appeared after rebase to master, dropped unnecessary
changes

git clang-format origin/master

fixed TestFreeRDPCodecRemoteFX.c

"formatting, run `clang-format` please"

properly use new "rfx_context_new(BOOL, UINT32)" everywhere

passed Threading Flags to "rfx_context_new" where available

in older C standarts veriables declaration must be done before any code

requested changes

clang-format as requested

use broken signatures of standert C functions for m$ s**tos

clang-format

requested changes

requested changes

moved ThreadingFlags to stable api zone

define type for channel msg handler

typo fix

clang-format

build fix

us ThreadingFlags from server settings

git clang-format origin/master

clang-format
2021-02-25 14:05:40 +01:00
akallabeth
43311130a2 Fixed CodeQL warnings 2021-02-19 11:19:49 +01:00
akallabeth
e2fd9db0b5 Added const to function arguments 2021-02-17 11:29:56 +01:00
akallabeth
d9d22aa422 Fixed sound buffering issues with compressed formats 2020-11-26 15:26:35 +01:00
akallabeth
6e3c00725a Cleaned up collections:
ArrayList, MessageQueue, Queue, PubSub, BipBuffer
ObjectPool and BufferPool
2020-11-06 12:30:13 +01:00
Felix Deimel
19f74a2698
Fixes #5747: Only activate sound output device (#6467)
* Fixes #5747: Only activate sound output device
2020-09-08 10:55:49 +02:00
Armin Novak
75aab487e2 Added duplicate initialization check for plugins. 2020-08-10 16:17:44 +02:00
akallabeth
64ad42b95b Fixed DestroyListener arguments and call order 2020-05-13 17:11:17 +02:00
akallabeth
2f5e5359f6 Destroy channel listeners on terminate 2020-05-12 11:40:42 +02:00
David Fort
46c4b7bdc2
Merge pull request #6166 from akallabeth/mac_sound_objc_link
Fixed #6163: Force linking to objective C runtime
2020-05-11 22:38:24 +02:00
akallabeth
eee1d7176b Fixed #6163: Force linking to objective C runtime
Sound channel requires the objective C runtime, force linking to
fix build issues on older mac os versions
2020-05-11 09:56:18 +02:00
akallabeth
2215fef975 Fixed oob read in rdpsnd_recv_wave2_pdu
Check format index before using it.
Thanks to hac425 CVE-2020-11041
2020-05-06 13:31:57 +02:00
akallabeth
f016f1ec09 Create data copy in case of dynamic sound channel. 2020-05-05 17:03:14 +02:00
akallabeth
af554b5a54 Use dedicated sound decoder thread. 2020-05-05 14:25:54 +02:00
Armin Novak
cb9e7fda32 Removed unused function. 2020-03-10 14:04:53 +01:00
Armin Novak
1fd51d9183 Fixed clang scanbuild warnings. 2020-03-04 09:17:35 +01:00
Martin Fleisz
3318d1574f Fix possible NULL pointer access crash 2020-02-28 12:53:39 +01:00
Armin Novak
4eb4f58fbb Updated CMake channel detection
* Now both, dynamic and static channel entries can be defined by
  a single channel.
* Added better logging to distinguish between static and dynamic
  channel messages.
2020-02-28 12:53:39 +01:00
Martin Fleisz
da354feed0 Add dynamic channel part for rdpsnd channel 2020-02-28 12:53:39 +01:00
Armin Novak
5e4603d0b7 Fix #5885: Check for division by zero 2020-02-27 13:56:53 +01:00
Vic Lee
25eb6b6cdd rdpsnd: implement buffer overrun detection. 2020-02-14 20:49:18 +08:00
Martin Fleisz
ebe0fc59b5 Merge pull request #5865 from akallabeth/write_cancelled_leak
Fix #5852: handle CHANNEL_EVENT_WRITE_CANCELLED
2020-02-10 12:08:55 +01:00
Vic Lee
847fe0f919 rdpsnd/winmm: fix some memory issues. 2020-02-04 17:56:45 +08:00
Armin Novak
d2aef75004 Fix #5852: handle CHANNEL_EVENT_WRITE_CANCELLED
When channels are cleaned up OpenHandle is most of the time
already 0. Ignore the argument checks for
CHANNEL_EVENT_WRITE_CANCELLED and CHANNEL_EVENT_WRITE_COMPLETE
only check where actually required (CHANNEL_EVENT_DATA_RECEIVED)
2020-01-29 08:52:25 +01:00
Martin Fleisz
706e32982e rdpsnd: Add synchronization to winmm backend 2020-01-17 13:56:30 +01:00
Martin Fleisz
369c696b23 rdpsnd: Fix possible crash and deadlock in winmm backend 2020-01-16 10:23:17 +01:00
Kobi Mizrachi
b94143f644 rdpsnd: server: fix leak in rdpsnd_server_context_free 2020-01-15 13:51:05 +02:00
Armin Novak
e86849759a Fixed waveOutClose, call waveOutReset first.
Signed-off-by: Armin Novak <armin.novak@thincast.com>
2020-01-08 18:25:08 +01:00
Armin Novak
f720ec5383 RDPSND device API refinements
* Added default format callback for rdpsnd backend to allow
  different default input formats (different samplerates, ...)
* Made WINMM backend in flight packet limitation a compile time
  option
* Fixed missing buffer copy in winmm backend

Signed-off-by: Armin Novak <armin.novak@thincast.com>
2020-01-08 17:14:09 +01:00
Martin Fleisz
05a865281e channels: Fix memory leak and make log messages more precise 2020-01-08 16:49:15 +01:00
Martin Fleisz
a98e153b9d rdpsnd: Do not set output device on Catalina or later (#5747) 2020-01-03 13:31:15 +01:00
Martin Fleisz
d21e0a6d6d Fix audio channel init when no audio devices are present
This PR fixes the handling of using rdpsnd or audin when the system has
no audio device available.
In case of a missing playback device the
Windows backend now correctly reports an error and the fake rdpsnd
backend is loaded.
If audin is enabled and no microphone is present the channel
initialization will report an error but it won't cut the connection (as
it did before).
2019-12-30 12:59:14 +01:00
Armin Novak
6e6dfc3e2a Removed rdpsnd client thread
The thread used to process audio data is not really required
and just produces overhead.
2019-12-05 11:40:56 +01:00
Martin Fleisz
71feb974ac
Merge pull request #5739 from akallabeth/improve_function_hiding
Improve function hiding
2019-12-02 11:31:35 +01:00
Armin Novak
7c243da6e1 Remove symbols exported by accident. 2019-12-02 10:57:31 +01:00
Armin Novak
65ebda20dd Fix #5747: Only open output device in rdpsnd for mac. 2019-11-25 08:27:57 +01:00
Armin Novak
72ca88f49c Reformatted to new style 2019-11-07 10:53:54 +01:00
Armin Novak
75ed12f1f0 Fixed userdata pointer and CHANNEL_EVENT_WRITE_CANCELLED message. 2019-11-06 13:01:43 +01:00
Armin Novak
1bcb799560 Listen to CHANNEL_EVENT_WRITE_CANCELLED and emit if queue is cleared. 2019-11-06 13:01:43 +01:00
Armin Novak
1b78b59926 Fixed #4809: Properly process CHANNEL_EVENT_WRITE_COMPLETE 2019-11-06 13:01:43 +01:00
Armin Novak
0c87eaee4d COMMAND_LINE_ARGUMENT structs contain parser results, use one per instance
Remove the old global structs as the parser modifies them. When using
multiple instances in the same process space this could break parsing.
2019-10-28 13:30:05 +01:00
Armin Novak
3ce1dc1972 Fix some warnings on mac os 2019-09-03 13:47:13 +02:00
Armin Novak
1b9e01509d Refactored winmm backend
Using CALLBACK_FUNCTION again, but protect with semaphore to avoid closing
the device while there are still buffers to be played.
2019-09-03 15:11:18 +02:00
Armin Novak
208fbabfde Only close local audio device if rdpsnd thread closes or output format changes.
Windows 7 and other older systems send one close PDU after another.
This distorts audio during setup and teardown of local sound devices.
2019-09-03 15:11:18 +02:00
Armin Novak
48f35972c8 Fixed limit check for wave confirm pdu timestamp. 2019-09-03 15:11:18 +02:00
Armin Novak
f93d625cde Use GetTickCount64 instead of GetTickCountPrecise. 2019-09-02 15:46:36 +02:00
Armin Novak
12b0b9ea28 Do not use named events, they are global! 2019-09-02 15:28:31 +02:00
Armin Novak
40964301df Use CALLBACK_EVENT for waveOutOpen to play synchronously. 2019-09-02 15:11:54 +02:00
kubistika
265e0848ed rdpsnd: subsystems: Add proxy subsystem 2019-08-29 14:39:17 +02:00
kubistika
faa833f97a rdpsnd: client: add rdpContext getter 2019-08-29 14:39:17 +02:00
Armin Novak
52af56d956 Added rdpsnd latency calculation. 2019-08-22 10:11:26 +02:00
Martin Fleisz
30c0127a29
Merge pull request #5510 from akallabeth/mac_realtime_sound
Mac realtime sound
2019-08-14 12:54:54 +02:00
Armin Novak
18e4245791 Added proper latency estimation for winmm sound backend. 2019-08-13 10:55:12 +02:00
Armin Novak
23069d1fe2 Convert input PCM to float format. 2019-08-12 08:13:43 +02:00
Armin Novak
5ffe2eed4e Mostly working AVAudio backend. 2019-08-02 14:00:32 +02:00
Armin Novak
624d895106 Fixed sign issues 2019-04-05 09:22:35 +02:00
Armin Novak
5612cbd8e6 Fixed dead store warnings 2019-04-05 09:14:35 +02:00
akallabeth
0a8ebcfcac
Merge pull request #5187 from astrand/mingw-part1
Mingw build fixes part1
2019-01-29 10:46:21 +01:00
Vic Lee
e2df67ab34 rdpsnd/winmm: remove an unnecessary blocking event. 2019-01-18 17:51:14 +08:00
Peter Åstrand (astrand)
30cd1ba1ab Use lowercase for includes and libs
Makes build possible on case sensitive systems such as MinGW on Linux.
2019-01-09 09:36:28 +01:00
Armin Novak
5490ceb4ed Fixed source format for freerdp_dsp_encode in rdpsnd_server_send_wave_pdu 2018-11-14 13:27:20 +01:00
Armin Novak
83f959ce6b Fixed format issues with server sound channel (review by @llysz) 2018-11-14 13:27:20 +01:00
Norbert Federa
af992f4ce1 channels/client: fix alsa/pulse warning and checks
- pa_stream_writable_size() returns (size_t) -1 on error
- fix missing cast in alsa client sound channel code
2018-10-23 09:45:20 +02:00
Armin Novak
fe7a37dcbd Cleaned up resource cleanup for rdpsnd alsa backend. 2018-10-22 14:53:46 +02:00
Armin Novak
3ed50aaca2 Implemented rdpsnd_pulse_get_volume 2018-10-22 13:17:25 +02:00
Armin Novak
9ff17dc0f4 fixed return value check in rdpsnd_recv_volume_pdu 2018-10-22 12:27:19 +02:00
Armin Novak
e2e1071ff5 Seal length in wave pdu alignment. 2018-10-22 12:16:18 +02:00
Armin Novak
1a015612a6 Align wave pdu size 2018-10-22 12:00:07 +02:00
Armin Novak
fb76f88cac Added missing length check and log message information. 2018-10-22 11:59:42 +02:00
Armin Novak
3d49697d19 Improved debug logging for sound device handling. 2018-10-22 10:27:16 +02:00
Armin Novak
ff7e91fed0 Removed unnecessary pulse context check. 2018-10-22 10:18:17 +02:00
Armin Novak
03dcfaf8db Unified sound device reopen in a single function. 2018-10-22 10:04:02 +02:00
Norbert Federa
d35470f8af rdpsnd: always call rdpsnd_server_send_formats
Since the rdpsnd_server_send_formats function is no longer exported
we must always call it, even if the rdpsnd server application uses
its own thread.
2018-10-18 10:21:15 +02:00
Armin Novak
3920c570dd Fixed memory leak with audio formats. 2018-10-15 16:33:56 +02:00
Armin Novak
2cf0662559 Unified format support for rdpsnd. 2018-09-26 12:49:52 +02:00
Armin Novak
a83c805ade Fixed format debug message. 2018-09-26 12:49:09 +02:00
Armin Novak
106dde9571 Working mic redirection for shadow server. 2018-09-26 12:49:09 +02:00
Armin Novak
28efbbc01f Refactored audio_format* functions. 2018-09-26 12:49:09 +02:00
Armin Novak
114abad767 Removed use of strcpy. 2018-08-27 14:34:09 +02:00
Armin Novak
d90e5da865 Fixed unused label warning. 2018-08-24 13:40:36 +02:00
Armin Novak
98c254ffa0 Fixed invalid return value type. 2018-08-01 12:56:18 +02:00
Martin Fleisz
0ec9579013 rdpsnd: Fix sending of wave2 PDU
According to MS-RDPEA 2.2.3.10 the Wave2 PDU's header BodySize field
should be equal the size of the PDU minus the header (4 Bytes).
2018-07-11 15:06:31 +02:00
Armin Novak
4465bcfa86 Fixed remarks 2018-07-04 11:03:32 +02:00
Armin Novak
a554207c11 Added target dependencies. 2018-07-02 16:58:14 +02:00
Armin Novak
7cd25027ad Fixed empty lib. 2018-07-02 16:38:21 +02:00
Armin Novak
373bfac9ab Added support for WAVE2 PDU in server side audio channel. 2018-07-02 16:20:39 +02:00
Armin Novak
e44d10a3e0 Merge remote-tracking branch 'origin/pr/4701' into reconnect_fixes 2018-06-19 12:46:58 +02:00
Armin Novak
a716dc244c Removed duplicate resource free. 2018-06-18 10:23:57 +02:00
Pascal J. Bourguignon
15f2bafeab Cleaned up const char** -> char** for argv, since we definitely do modify the argv!
(we overwrite the password and pin arguments).
This implies changes in the argument parsing tests that now must pass a mutable argv
(copied from the statically declared test argvs).
Some other const inconsistency have been dealt with too.
2018-06-06 16:43:09 +02:00
David Fort
0255a7db15
Merge pull request #4654 from akallabeth/alsa_latency_patch
Return real alsa latency if buffer is filled.
2018-05-16 09:53:30 +02:00
Armin Novak
c078aee238 Return real alsa latency if buffer is filled. 2018-05-16 08:52:55 +02:00
Armin Novak
0cf4dcc016 Fix missing sound arrival time for wave2 PDU 2018-05-15 14:57:00 +02:00
Martin Fleisz
c4e8685a29
Merge pull request #4623 from akallabeth/mac_sound_backend_fix
Fixed mac sound backend initialization.
2018-05-04 13:08:45 +02:00
Armin Novak
87c19b30d0 Fixed uninitialized return and early resource cleanup. 2018-05-04 12:36:29 +02:00
Armin Novak
670c1190c4 Fixed formats supported by backend. 2018-05-04 09:44:06 +02:00
Armin Novak
17d43edafb Fixed mac sound backend initialization. 2018-05-03 16:12:12 +02:00
Armin Novak
066cb52caa Fixed treat_wave sample length and checks. 2018-05-03 10:08:56 +02:00
David Fort
d07d06b28c rdpsnd: add support for wave2 PDU in client (#2)
To achieve this the announced version number is bumped to 8.
2018-04-16 08:56:09 +02:00
Armin Novak
3606b66cc3 Fix rdpsnd channel detached handling.
Do not play samples if detached, but handle every other message
just like with an attached channel.
2018-04-11 08:48:29 +02:00
Armin Novak
82ad911ee5 Added fake rdpsnd backend. 2018-04-09 17:39:08 +02:00
Armin Novak
030e9fc12f Fixed channel duplicate disconnect handling 2018-04-09 11:27:54 +02:00
Armin Novak
3f712cab70 Fixed formatting of changed files. 2018-04-05 13:14:16 +02:00
Armin Novak
ec5dab973f Initialized ALSA backend format. 2018-04-05 13:14:16 +02:00
Armin Novak
f89c1857b9 Rewrite of sound and microphone channels
The sound and microphone redirection channels (and in part TSMF)
did not properly decouple encoding/decoding from the backends used
to play/record sound.
Encapsulating encoding/decoding in rewritten freerdp_dsp_* functions
with variable backends, simplifying alsa/oss/pulse/... audio backends.
2018-04-05 13:14:16 +02:00
Armin Novak
2517755d25 Fixed thread function return and parameters. 2018-03-07 14:36:55 +01:00
Armin Novak
6623927fe4 Free gsmBuffer on channel close. 2018-02-19 14:04:42 +01:00
Armin Novak
3b67190d17 Clean up GSM context on channel close. 2018-02-19 13:05:53 +01:00
David Fort
41823080f9 Fix users of Stream_GetPosition() that returns size_t 2017-12-11 22:38:58 +01:00
Armin Novak
f96a46acd5 Fix #4278: Fix nasty range check bug 2017-11-26 14:59:37 +01:00
Armin Novak
4eb5b8e349 Replaced atoi 2017-11-15 15:52:16 +01:00
Armin Novak
7058a9add2 Pause playback on queue empty, free buffers on close. 2017-10-05 12:05:09 +02:00
Armin Novak
8b9e3fa51e Fixed use of reserved keywords for include guards. 2017-07-20 09:35:41 +02:00
Armin Novak
0490aeb018 Fixed clang malloc integer overflow warnings. 2017-07-20 09:29:48 +02:00
Armin Novak
7960251e2c Fixed audio termination code. 2017-01-17 16:06:04 +01:00
Armin Novak
9f19da798c Added attach/detach support for channels. 2016-12-19 17:07:01 +01:00
Norbert Federa
f71b6b46e8 fix string format specifiers
- fixed invalid, missing or additional arguments
- removed all type casts from arguments
- added missing (void*) typecasts for %p arguments
- use inttypes defines where appropriate
2016-12-16 13:48:43 +01:00
Bernhard Miklautz
00dae7c5ef Fix some spelling errors
Fixes #3633
2016-12-01 15:36:49 +01:00
Norbert Federa
c6e6b44143 countless WLog/printf format specifier fixes 2016-11-25 17:06:25 +01:00
Martin Fleisz
0febd9c7cd Merge pull request #3563 from akallabeth/android_update
Android fix warnings, visibility and formatting
2016-11-24 12:59:30 +01:00
Martin Haimberger
778767cafe fixed error 2016-11-23 04:22:03 -08:00
Martin Haimberger
7fe28a8a78 virtualChannel: removed static variable usage from
VirtualChannelApi
2016-11-23 04:17:56 -08:00
Martin Haimberger
d29848f383 rdpsnd: using new VirtualChannelEx api 2016-11-23 03:50:22 -08:00
Marc-André Moreau
dee76617d9 channels: remove thread-local storage usage 2016-11-15 11:41:01 -05:00
Marc-André Moreau
70c4646722 channels: restore global tables for initHandle, openHandle mappings instead of thread local storage 2016-11-14 15:23:05 -05:00
Armin Novak
6ca5a1324f Android: fixed warnings, reformatted. 2016-10-17 10:21:23 +02:00
Armin Novak
943e295714 WLog using C99 compatible variadic macros. 2016-10-07 14:05:27 +02:00
Armin Novak
9d0f7534e3 Fixed use after free. 2016-10-06 13:43:15 +02:00
Armin Novak
b03e47166e Fixed NULL pointer checks. 2016-10-06 13:43:14 +02:00
Armin Novak
1b6cf57307 Reformatted file. 2016-10-06 13:43:13 +02:00
Armin Novak
9f5da483dc Reformatted files touched in last 2 commits. 2016-10-06 13:43:12 +02:00
Armin Novak
64590e7e89 Set pEntryPointsEx->ppInterface NULL on error. 2016-10-06 13:43:12 +02:00
Armin Novak
88a3b8dd76 Initializing channel context in each thread. 2016-10-06 13:43:12 +02:00
Armin Novak
dadc5262ae Removed static channel variables.
Global static variables do not work, if more than one instance
of an RDP client is running in the same process space.
Removed the varaibles where possible and replaced them with
thread local storage where necessary.
2016-10-06 13:43:09 +02:00
Ondrej Holy
2fec57f1a0 rdpsnd/pulse: Fix crashes in pulseaudio
Function pa_stream_trigger has to be called under lock to avoid
following crashes on asserts:

Assertion 'e->mainloop->n_enabled_defer_events > 0' failed at pulse/mainloop.c:257, function mainloop_defer_enable(). Aborting.
Assertion '!e->next' failed at pulsecore/queue.c:104, function pa_queue_pop(). Aborting.
Assertion 'q->front' failed at pulsecore/queue.c:81, function pa_queue_push(). Aborting.
2016-10-04 15:18:16 +02:00
David PHAM-VAN
fe2e4264af Fix Memory Leaks in RdpSnd 2016-09-19 11:27:25 -07:00
Vic Lee
019a569d42 rdpsnd/server: decrease audio latency and make it configurable. 2016-06-21 17:22:43 +08:00
Norbert Federa
90cdfa7646 cmake: replaced STATIC_CHANNELS with BUILTIN_CHANNELS 2016-06-15 13:36:27 +02:00