Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary audio delay #2020

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

Remove unnecessary audio delay #2020

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: NetBSD, All

Comments on the original bug report:

On 2015-11-13 14:16:39 +0000, Thomas Klausner wrote:

Created attachment 2299
Patch removing the delay.

The BSD audio backend has an SDL_Delay inside, which is unnecessary, since writing audio is automatically slowing it down (there is a limited buffer size). Remove it. (patch in pkgsrc for ages, no user complaints)

On 2015-12-29 07:39:10 +0000, Ryan C. Gordon wrote:

(In reply to Thomas Klausner from comment # 0)

The BSD audio backend has an SDL_Delay inside, which is unnecessary, since
writing audio is automatically slowing it down (there is a limited buffer
size). Remove it. (patch in pkgsrc for ages, no user complaints)

Well, this might be necessary on BSD systems other than NetBSD...at a minimum, it looks like it's meant to work around driver quirks.

Maybe we can wrap this in an #ifndef NetBSD with a comment that this condition isn't necessary on that platform, instead?

--ryan.

On 2015-12-29 19:10:35 +0000, Thomas Klausner wrote:

The comment at the top of the file says that this file is the audio backend for OpenBSD and NetBSD. I've checked OpenBSD ports and found that they use the OpenBSD-specific sndio backend instead.
I've also checked FreeBSD ports, and they use the esd backend.

That said, I have no problem with a '#ifndef NetBSD' around the code instead, but I think it's not really necessary.

On 2015-12-29 22:16:07 +0000, Thomas Klausner wrote:

Looking more closely still: In configure, src/audio/bsd is only used on NetBSD.

On 2015-12-30 06:42:33 +0000, Ryan C. Gordon wrote:

(In reply to Thomas Klausner from comment # 2)

I've also checked FreeBSD ports, and they use the esd backend.

Oh my god, can that actually be true? That has to be a mistake.

Let's leave this as-is (and this bug open) until 2.0.4 is finished, and then I'll figure out what happened with that. If this really has turned into a NetBSD-only audio target, let's rename it to "netbsd" and remove that delay code.

--ryan.

On 2016-10-28 23:12:10 +0000, Thomas Klausner wrote:

Just a ping since not only 2.0.4, but also 2.0.5 has been out in the meantime.

On 2017-05-25 00:08:48 +0000, Ryan C. Gordon wrote:

(In reply to Thomas Klausner from comment # 5)

Just a ping since not only 2.0.4, but also 2.0.5 has been out in the
meantime.

This has been renamed from "bsd" to "netbsd" in https://hg.libsdl.org/SDL/rev/25cd7fe50180 ...we can resolve the SDL_Delay thing now.

However, as it stands right now, it looks like this code is opening the device with O_NONBLOCK. A lifetime ago, we needed to open() audio devices on Linux as O_NONBLOCK because Open Sound System might hang indefinitely otherwise--during the open() call! It's 100% possible this is not a problem NetBSD has or ever had. If so, I'd like to make sure the device on NetBSD is not opened as O_NONBLOCK and delete all the #ifndef USE_BLOCKING_WRITES code in src/audio/netbsd.

(One of the primary reasons Open Sound System would block indefinitely is if something else had the device open...so an MP3 player in the background, or Esound daemon or whatever, would cause games to hang on startup. I just need some assurance that NetBSD won't have that problem.

--ryan.

On 2017-05-25 00:10:33 +0000, Ryan C. Gordon wrote:

(To be clear: there are several SDL_Delay calls, not just the one in Attachment # 2299, and I'd like to remove them all if possible.)

--ryan.

On 2017-07-27 09:52:03 +0000, Thomas Klausner wrote:

Starting from the upcoming NetBSD 8.0 release, NetBSD comes with an in-kernel audio mixer, so there are no limits on parallel opened audio devices (see https://blog.netbsd.org/tnf/entry/netbsd_8_0_release_process).
Does that answer your question?

On 2019-06-12 17:07:16 +0000, Ryan C. Gordon wrote:

We applied the patch from NetBSD's package system, which removes the SDL_Delay() and fixes a bunch of other stuff too.

That patch is here: https://hg.libsdl.org/SDL/rev/f26b341b14b4

In theory, this should resolve all the problems, but please reopen this bug if there an issue.

(THANK YOU for being so patient with this bug that was opened so long ago!)

--ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant