Commit Graph

572 Commits

Author SHA1 Message Date
akallabeth
41bd8bd3fb [various] fix integer conversions 2023-08-04 15:07:56 +02:00
Armin Novak
970f0c54e8 [stream] use const correct Stream_Pointer access 2023-06-08 08:09:33 +02:00
Armin Novak
a4c6b36a19 [build] fix memory sanitizer stack frame warnings 2023-06-07 09:14:45 +02:00
Armin Novak
b15edda614 [cmake] changed rdpsnd-common to STATIC library 2023-05-22 12:57:16 +02:00
akallabeth
239cd9212e [channels] fix static linking of common libraries 2023-05-12 08:03:56 +02:00
akallabeth
2b3c8c47a4 [build] fix install with BUILD_SHARED_LIBS=OFF
generate proper CMake targets so static linking works again.
2023-05-12 08:03:56 +02:00
akallabeth
a5b42f0f84 [includes] untangled circular includes 2023-03-15 08:22:23 +01:00
akallabeth
273bb6a7a8 [build] use static libraries as intermediate 2023-03-01 08:18:34 +01:00
akallabeth
c054666311 [channels] simplified channel subsystem linking 2023-03-01 08:18:34 +01:00
akallabeth
cf9777cd92 [channels] simplified server linking 2023-03-01 08:18:34 +01:00
akallabeth
c3a82daad6 [channels] simplified client linking 2023-03-01 08:18:34 +01:00
akallabeth
0307482506 [channels,rdpsnd] add rdpsnd-common object lib 2023-03-01 08:18:34 +01:00
Armin Novak
641022b795 [logging] remove __FUNCTION__ from actual message
prefer the log formatter to provide that information.
2023-01-25 16:26:39 +01:00
akallabeth
075506f6c8 [winpr,stream] use new Stream_CheckAndLogRequiredLength* 2023-01-25 14:27:32 +01:00
akallabeth
1f16250a7b [channels,rdpsnd] prevend multiple OnOpen calls
due to the nature of the sound channel there are multiple listeners
waiting for the server to open the channel and most of them are called
by the server. Only open the channel once.
2022-12-15 14:57:29 +01:00
akallabeth
4ab9fb4425 [channels,rdpsnd] Add PlayEx callback
This new callback is preferred over the older Play callback and provides
the AUDIO_FORMAT as additional argument.
2022-12-14 10:17:30 +01:00
akallabeth
8aa880c0ba [channels,rdpsnd] Callback on server format
When the server sends the format list to the client call a device
callback that provides the details to the audio backend.
2022-12-14 10:17:30 +01:00
akallabeth
babc47e19c [channels,rdpsnd] fix rdpsnd channel cleanup
The rdpsnd channel needs to keep the resources allocated until the last
user (static, dynamic channel) is terminated.
2022-12-13 10:57:34 +01:00
akallabeth
7ab917dca8 Fixed Wsign-compare warnings 2022-12-09 15:58:26 +01:00
Armin Novak
64c94e06f3 [channel,rdpsnd] fix queue cleanup
The argument is of type wMessage* and we only care for messages with an
ID of 0
2022-12-09 12:30:14 +01:00
Armin Novak
b25234da66 [channels] Abort event wain on abortEvent 2022-12-09 12:30:14 +01:00
Armin Novak
dacebc62a3 Use Stream_CheckAndLogRequiredLength, fix WLog TAG
* Log stream length requirement violations
* Use proper defines for WLog tags
2022-11-21 09:57:27 +01:00
akallabeth
1849632c43
Fixed format strings to match arguments (#8254)
* Fixed format strings to match arguments

Reviewed and replaced all %d specifiers to match proper type

* Added proxy dynamic channel command type to log messages.
2022-09-29 14:55:27 +02:00
akallabeth
7b02aba636 Removed ALAW/ULAW from alsa/oss/pulse backends
The codec does not work reliably with some hardware.
2022-07-05 14:20:19 +02:00
akallabeth
c698f7e7d9 Expose client rdpsnd get context function 2022-06-23 14:19:50 +02:00
akallabeth
f1d3d457fb Code cleanups/initializations 2022-06-23 14:19:50 +02:00
akallabeth
bc8b4ade1c reformatted 2022-06-23 08:48:39 +02:00
David Fort
e389210673 client channels: mutualize common types between dynamic channels
Most dynamic channels share the same copied and pasted code for the XXX_CHANNEL_CALLBACK
and XXX_LISTENER_CALLBACK types. This patch introduce GENERIC_CHANNEL_CALLBACK and
GENERIC_LISTENER_CALLBACK that fits for most channels and discard custom type definitions.
2022-06-15 14:04:58 +02:00
Pascal Nowack
3337810520 server/rdpsnd: Add API to get notified of channel id 2022-06-08 09:30:30 +02:00
akallabeth
35f575a753 Refactored rdpsnd server
* Assert all input arguments
* Unify stream buffer handling
2022-06-03 08:48:46 +02:00
Pascal Nowack
902727df5e rdpsnd: Enhance server implementation
The current server sided channel handling of RDPSND/AUDIO_PLAYBACK_DVC
is currently very constrained.
So, solve this. This means:

- Add the missing Training/Training Confirm PDUs
- Stop overriding the average bytes per second values, when submitting
  the audio formats, as this currently makes the usage of codecs
  impossible
- Add a way to send the server formats manually again, to be able to
  restart the protocol after a Close PDU was sent
- Add a way to send already encoded audio data to let server
  implementations to take care of the encoding process and to set
  custom audio timestamps for the Video Optimized Remoting channel
- Add public attributes to let server implementations know the initial
  volume and pitch values
- Add public attribute to let server implementations know the quality
  mode setting
2022-06-03 08:48:46 +02:00
Pascal Nowack
7d18ca4dc2
rdpsnd/client: Fix handling of WaveConfirm PDUs (#7910)
Currently, all FreeRDP-based clients don't send any WaveConfirm PDUs
for received samples, when using a dynamic channel for audio output
redirection.
[MS-RDPEA] 2.2.3.8 Wave Confirm PDU mentions, that a WaveConfirm PDU
MUST be sent, when a WaveInfo PDU + Wave PDU, or Wave2 PDU is received
and when the audio data sample is emitted to completion by the client.
The first WaveConfirm PDU is used by the server to determine the
network latency and the second WaveConfirm PDU is used by the server to
determine the render latency.

So, fix the current behaviour, where FreeRDP currently does not send
any WaveConfirm PDU, when using the dynamic channel, or only sends one
WaveConfirm PDU for the sample.
For the first WaveConfirm PDU, use the same timestamp, that was
included in the first WaveInfo/Wave2 PDU.
For the second WaveConfirm PDU, add the render latency on top of the
arrival timestamp.
2022-05-18 08:47:54 +02:00
Felix Deimel
b0772fe2f0 Fixed memory leaks in rdpsnd mac 2022-05-12 14:51:56 +02:00
akallabeth
1819c24808 Remember received sound volume and apply on open. 2022-04-28 18:56:17 +02:00
akallabeth
5521a73e90 Some rdpsnd debug improvements 2022-04-28 18:56:17 +02:00
akallabeth
962c5c3ef0 Fixed dead store warnings 2022-04-28 12:37:19 +02:00
akallabeth
667b471686 Fixed cast-quality warnings 2022-04-28 09:17:20 +02:00
akallabeth
73cdcdfe09
Logging and parser fixes (#7796)
* Fixed remdesk settings pointer

* Fixed sign warnings in display_write_monitor_layout_pdu

* Use freerdp_abort_connect_context and freerdp_shall_disconnect_context

* Added and updates settings

* info assert/dynamic timezone

* mcs assert/log/flags

* Fixed and added assertions for wStream

* Unified stream length checks

* Added new function to check for lenght and log
* Replace all usages with this new function

* Cleaned up PER, added parser logging

* Cleaned up BER, added parser logging

* log messages

* Modified Stream_CheckAndLogRequiredLengthEx

* Allow custom format and options
* Add Stream_CheckAndLogRequiredLengthExVa for prepared va_list

* Improved Stream_CheckAndLogRequiredLength

* Now have log level adjustable
* Added function equivalents for existing logger
* Added a backtrace in case of a failure is detected

* Fixed public API input checks
2022-04-19 14:29:17 +02:00
akallabeth
37421b6614
Unified rdpsnd cleanup code (#7697) 2022-03-04 09:55:37 +01:00
Armin Novak
4d03d7c0bf Freerdp remove #ifdef HAVE_CONFIG_H 2022-03-03 11:26:48 +01:00
Armin Novak
b2ad47a809 Reorganized FreeRDP headers 2022-03-03 11:26:48 +01:00
Armin Novak
a9463bfdda Fixed const warnings 2022-03-01 08:00:25 +01:00
Armin Novak
94634bfd67 Fixed const warning 2022-02-24 12:06:06 +01:00
Armin Novak
fd027d1bf0 Removed BUILTIN_CHANNELS
Building client channels out of tree does not work reliable as the
dependencies can not be easily split. (exceptions may be simple ones
as echo channel)
It does complicate the build system and code though, so remove this
for maintainability reasons.
2022-02-23 10:43:46 +01:00
Armin Novak
951a83e295 Fixed deprecated mac symbol 2022-02-22 11:29:56 +01:00
akallabeth
42abdb056f Use define for channel name 2022-02-22 09:44:13 +01:00
akallabeth
8cc6582044
Unify struct definitions (#7633)
* Unified enum/struct definitions, fixed include issues

* Fixed mac compilation issues

* Added missing include

* Fixed windows server build warnings

* Fixed VS2010 build issue

* Removed unnecessary library linking

* Fixed ThreadPool WinXP compatibility

* Fixed pr review remarks
2022-02-14 14:59:22 +01:00
akallabeth
7d5e5764e3 Removed dead code. 2022-01-19 09:24:57 +01:00
Armin Novak
0fb83a304d Adjusted channelID and server SetVolume data types 2021-12-20 08:11:00 +01:00
Richard Markiewicz
49f9f5c265 freerdp: remove SetFormat from iOS rdpsnd entry points, fix const-ness of interface methods 2021-12-16 08:49:49 +01:00
Steve Pronovost
f6f4acc921 Added support for AUDIO_PLAYBACK_DVC
Support audio on dynamic channel. Please refer to MS-RDPEA.
2021-10-21 13:11:21 +02:00
akallabeth
03a9ca80c8
Refactor proxy (#7312)
* Added hidden transport dump and replay options

* Added settings to enable transport dump and replay
* Added check in freerdp_connect to skip authentication on
  dump replay

* Fixed proxy issues

* Proper shutdown handling
* Uninitialized variables
* Skip proxy-client channels, initialize from peer channels and
  config
* Filter static channels like dynamic ones
* Added proxy module filtering from config data (channels, input, ...)

* Removed oboslete proxy decoding related files

* Added defines for RDPECAM channel

* Added proxy config options:

* VideoRedirection
* CameraRedirection

* Fixed duplicate channel free
2021-09-23 14:52:03 +02:00
akallabeth
7b7e2d6f32 Prefer constant division over multiplication for length checks 2021-09-21 08:55:22 +02:00
Armin Novak
cbd30544f8 Fix rdpsnd number of event handles 2021-09-20 10:59:59 +02:00
akallabeth
5b78d02d5d Fixed unchecked variable access 2021-09-20 10:59:59 +02:00
akallabeth
1ca7e1f7a0 Added option to disable graphics decoding in client code path 2021-09-20 10:59:59 +02:00
Armin Novak
ba0da04217 Fixed compilation warnings and duplicate defines 2021-09-09 08:53:20 +02:00
Armin Novak
95ecc6929a Refactored channel error handling
* Fix WINPR_ASSERT if a client can not allocate new resources,
  terminated cleanly instead.
* Add WINPR_ASSERT for lots of channel arguments
2021-09-09 08:53:20 +02:00
Armin Novak
467f7c3f6a Fixed proxy ulimit graceful client disconnect 2021-09-09 08:53:20 +02:00
Armin Novak
0f8c52b9ca Fixed const warnings with argument parser 2021-09-09 08:53:20 +02:00
Armin Novak
976c3c2ab9 Refactored proxy and proxy-modules:
* Split out proxy headers and moved to public API to allow external
  modules to be built.
* Split proxy into proxy library and proxy binary. The library
  can be used by other applications and provides a simple API
* Improved channel passthrough, now all channels including dynamic
  channels work.
* Extended module API to hook more events, improved module samples
* Cleaned up proxy code, removed global static variables used,
  added WINPR_ASSERT
2021-09-09 08:53:20 +02:00
akallabeth
732a4d3839 Ignore NULL pointer as rdpsnd_server_context_free argument 2021-09-06 10:11:14 +02:00
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