We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2835 - Audio Latency - Artificial buffer limit of 1/4 second.
Summary: Audio Latency - Artificial buffer limit of 1/4 second.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 2.0.3
Hardware: x86_64 Windows 8
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: triage-2.0.4
Depends on:
Blocks:
 
Reported: 2015-01-07 01:05 UTC by Jon Olick
Modified: 2015-03-24 06:13 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Olick 2015-01-07 01:05:50 UTC
Turns out in the code there is an artificial mimimum audio buffer size of a quarter second. This is a pretty significant amount of latency, especially in VR. Removing the minimum was an easy fix for this.

--- a/deps/sdl2-2.0.3/src/audio/winmm/SDL_winmm.c
+++ b/deps/sdl2-2.0.3/src/audio/winmm/SDL_winmm.c
@@ -280,8 +280,8 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
         this->spec.channels = 2;        /* !!! FIXME: is this right? */

     /* Check the buffer size -- minimum of 1/4 second (word aligned) */
-    if (this->spec.samples < (this->spec.freq / 4))
-        this->spec.samples = ((this->spec.freq / 4) + 3) & ~3;
+    //if (this->spec.samples < (this->spec.freq / 4))
+    //    this->spec.samples = ((this->spec.freq / 4) + 3) & ~3;

     while ((!valid_datatype) && (test_format)) {
         switch (test_format) {
Comment 1 Ryan C. Gordon 2015-02-19 06:32:14 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry
if you got a lot of email from this. This is to help me sort through some bugs
in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4,
though!
Comment 2 Ryan C. Gordon 2015-03-24 06:13:41 UTC
This patch is now https://hg.libsdl.org/SDL/rev/eb1bde345c4b, thanks!

--ryan.