-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Actual latency is double what is requested (off by one in the prefs) #6065
Comments
Commented by: rryan Bill can you take a look? |
Commented by: rryan I think this is not a bug but more of a logging error. I just checked and at 1ms latency, 44.1kHz, the engine is receiving requests for 128 stereo samples at a time. 128 stereo samples = 64 frames = 64 frames / 44.1kHz = 1.45ms |
Commented by: rryan And here is a section from my log file. I build PortAudio with debug info on, so it spits out those extra lines in between. I'm not sure what is going on. I think that maybe our user buffer is set to 1.45 ms but maybe my soundcard is requiring at least 128 frames so the host buffer is 128 frames while my user buffer is 64.
|
Commented by: rryan And here it is for 11ms selected in preferences.
|
Commented by: Pegasus-RPG
Are we getting our stereo and mono frame counts mixed up or is there something wrong with PortAudio? |
Commented by: rryan Sean reports that in Windows this behavior does not happen. Can somebody
|
Commented by: bkgood
I'm not understanding the problem at this point. Does those lines not correspond to a selection of 2ms and 23ms (respectively) in the preferences? |
Commented by: bkgood *do those lines... ugh |
Commented by: daschuer I can find this in the log: Requested sample rate: 44100 Hz, latency: 92.8798 ms "[Master], latency" is set to 185.76 ms Latency in preferences is 92.9 ms
Actual, Mixxx uses a buffer of 92.9 ms The other latency values are also effected. Currently "[Master], latency" is currently unused. |
Commented by: Pegasus-RPG Bill: Yes, those values do not correspond: |
Commented by: daschuer It looks like there is an PA bug somewhere in scr/hostapi/alsa/pa_linux_alsa.c line 1994 ff I will prepare a patch which solves the problem within Mixxx. Has one connection to the PA team for clarification? |
Commented by: daschuer here it is: |
Commented by: bkgood Line 1994 in PA trunk is a closing brace http://www.assembla.com/code/portaudio/subversion/nodes/portaudio/trunk/src/hostapi/alsa/pa_linux_alsa.c?rev=1858#ln1994 , can you find this issue in the current code? I don't recall seeing this with ALSA on my Linux machine so doing a blanket division by 2 for all ALSA-users has a lot of collateral damage as presumably I'm not the only one. I've seen PortAudio do things similar to this in the past because it doesn't think it can open the device with those parameters, so it tries with less demanding values (iirc the pa docs say the latency parameters are only suggested values, with PA doing the best it can to match them). |
Commented by: daschuer Hi Bill, I had a look in "portaudio19-19+svn20111121" To clarify the issue again: My Ubuntu Lucid and my Ubuntu Precise are effected. Which ALSA Systems are not effected? |
Commented by: bkgood I use Arch with portaudio built from svn, and I don' t remember being able to reproduce this. But I misunderstood, I thought the stream was being opened with a higher-than-requested latency, which can be normal PA behaviour. If it's just a reporting error, I'm not that worried about it, so I withdraw my objection -- sorry for the confusion. |
Commented by: daschuer Bill, can you please have a look to your latest log file and report if Arch linux is affected as well? |
Commented by: Pegasus-RPG Please talk to the PA team (developers mailing list) as they are usually good about fixing things. Since this is just a reporting issue, I would also rather not blindly divide by two. Either leave it as-is or only divide by two if the PA version number is less than whatever one in which this gets fixed. |
Commented by: daschuer Here is the thread on the Portaudio mailing list: |
Commented by: daschuer Reading. In "streamDetails->outputLatency", PA tries to report all latencies that are known. Unfortunately it does not only depend on the Sound API but also on the selected device. On my hardware PA reports 42 ms for ALSA + Intel sound card and 64 ms for ALSA + pulse, with the suggested Latency of 21 ms. In fact, the output latency is currently controlled by the buffer provided by Mixxx in this case. So the patch from #12 is not a solution. A flexible solution would be to allow the user to set the Buffer and the latency independent and report the current Latency in the GUI. This will offer optimum flexibility but will clutter the GUI and opens an other window for miss configuration. The best solution for me, will be to set the buffer size in ms by user preferences and request a minimum latency. In this case PA will adopt this minimum possible Latency with this buffer. In fact, nothing will change compared to the current behavior except the wording. Additional we could report the current Latency in the preferences see Bug #884688. What do you think? |
Commented by: daschuer Bug #884694 confirms that it is fine to set the buffer size in preferences. |
Commented by: daschuer The attached patch changes the latency configuration to audio buffer size configuration (like it actually already is). |
Commented by: daschuer Is this a candidate for 1.11? |
Commented by: daschuer IMHO Mixxx 1.11.1 will only include band aid fixes. |
Issue closed with status Fix Released. |
Reported by: Pegasus-RPG
Date: 2011-11-01T11:25:04Z
Status: Fix Released
Importance: High
Launchpad Issue: lp884705
Tags: latency
Attachments: pa_alsa.patch, AudioBufferSize.patch
This only happens on my Linux system: Debian Squeeze AMD64, qt 4.6.3 as of 1.10 branch r2870.
Since that's obviously a hack, and I don't see the problem on my Windows machine, I leave it to those that know more to investigate further.
The text was updated successfully, but these errors were encountered: