Commit Graph

19 Commits

Author SHA1 Message Date
Pierre Wendling 501a499180 Add clang-format on/off comments where necessary.
Comments were added in places where INDENT-ON/OFF comments are. Places
like stdlib's asm don't need it as clang-format doesn't try to indent it.
2022-05-19 01:31:29 -07:00
pionere a70bb259c7 drop handle parameter of OpenDevice 2022-01-28 20:40:19 -05:00
pionere 2eafe4340c cleanup/sync the main loop of *_OpenDevice functions to pick audio format 2022-01-28 20:40:19 -05:00
pionere 1043dd8c0d adjust handling of iscapture
- drop iscapture parameter of OpenDevice
- use SDL_bool for iscapture
2022-01-28 20:40:19 -05:00
pionere 0dda8a7f4c cleanup init functions of audio
- use SDL_bool if possible
- assume NULL/SDL_FALSE filled impl
- skip zfill of current_audio at the beginning of SDL_AudioInit (done before the init() calls)
2022-01-28 20:40:19 -05:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Sam Lantinga bf97c5a22f Make sure SDL file descriptors don't leak into child processes 2021-09-08 14:47:40 -07:00
nia a5f3ea1448 netbsdaudio: Handle ioctls failing
A user reported that the mpv video player hangs after attempting to
set an unsupported number of channels with the SDL audio output,
because it thinks it's successfully opened the device. This makes
the failure graceful.
2021-03-13 18:37:21 -08:00
Sam Lantinga 50ea3b77f1 Fixed bug 5080 - SDL_netbsdaudio: Always use the device's preferred frequency
Nia Alarie

The NetBSD kernel's audio resampling code is much simpler and lower quality than libsamplerate.

Presumably, if SDL always performs I/O on the audio device in its native frequency, we can avoid resampling audio in the kernel and let SDL do it with libsamplerate instead.
2021-01-08 10:09:37 -08:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Sam Lantinga 9525f9729a Fixed bug 5076 - SDL_netbsdaudio: Add support for 32-bit LPCM
Nia Alarie

The kernel supports this, make SDL expose it so it can be used.
2020-04-05 10:44:51 -07:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sam Lantinga 15bae953b1 Fixed bug 4642 - Rework SDL_netbsdaudio to improve performance
Nia Alarie

The NetBSD audio driver has a few problems. Lots of obsolete code, and extremely bad performance and stuttering.

I have a patch in NetBSD's package system to improve it. This is my attempt to upstream it.

The changes include:

* Removing references to defines which are never used.
* Using the correct structures for playback and recording, previously they were the wrong way around.
* Using the correct types ('struct audio_prinfo' in contrast to 'audio_prinfo')
* Removing the use of non-blocking I/O, as suggested in #3177.
* Removing workarounds for driver bugs on systems that don't exist or use this driver any more.
* Removing all usage of SDL_Delay(1)
* Removing pointless use of AUDIO_INITINFO and tests that expect AUDIO_SETINFO to fail when it can't.

These changes bring its performance in line with the DSP audio driver.
2019-06-08 13:03:36 -07:00
Sam Lantinga 5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Sam Lantinga e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga fb835f9e3b Fixed bug 2330 - Debian bug report: SDL2 X11 driver buffer overflow with large X11 file descriptor
manuel.montezelo

Original bug report (note that it was against 2.0.0, it might have been fixed in between):  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733015

--------------------------------------------------------
Package: libsdl2-2.0-0
Version: 2.0.0+dfsg1-3
Severity: normal
Tags: patch

I have occasional crashes here caused by the X11 backend of SDL2. It seems to
be caused by the X11_Pending function trying to add a high number (> 1024)
file descriptor to a fd_set before doing a select on it to avoid busy waiting
on X11 events. This causes a buffer overflow because the file descriptor is
larger (or equal) than the limit FD_SETSIZE.

Attached is a possible workaround patch.

Please also keep in mind that fd_set are also used in following files which
may have similar problems.

src/audio/bsd/SDL_bsdaudio.c
src/audio/paudio/SDL_paudio.c
src/audio/qsa/SDL_qsa_audio.c
src/audio/sun/SDL_sunaudio.c
src/joystick/linux/SDL_sysjoystick.c


--------------------------------------------------------

On Tuesday 24 December 2013 00:43:13 Sven Eckelmann wrote:
> I have occasional crashes here caused by the X11 backend of SDL2. It seems
> to be caused by the X11_Pending function trying to add a high number (>
> 1024) file descriptor to a fd_set before doing a select on it to avoid busy
> waiting on X11 events. This causes a buffer overflow because the file
> descriptor is larger (or equal) than the limit FD_SETSIZE.


I personally experienced this problem while hacking on the python bindings
package for SDL2 [1] (while doing make runtest). But it easier to reproduce in
a smaller, synthetic testcase.
2017-08-14 20:22:19 -07:00
Philipp Wiesemann 4c190ce584 netbsd: Fixed comment. 2017-07-01 23:00:07 +02:00
Philipp Wiesemann 7bb6b402c2 netbsd: Fixed compile error. 2017-06-29 23:00:09 +02:00
Ryan C. Gordon a7fc2822d4 audio: rename bsd target to netbsd.
Apparently this is no longer a generic BSD audio target, and hasn't been for
years, so rename it for NetBSD.
2017-05-24 19:56:59 -04:00