[Bug 28723] Sound stutter in Rage when emulated windows version is set to "Windows 7" (XAudio2 -> mmdevapi sound output path)

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Dec 9 02:02:49 CST 2011


http://bugs.winehq.org/show_bug.cgi?id=28723

--- Comment #78 from Alexey Loukianov <mooroon2 at mail.ru> 2011-12-09 02:02:49 CST ---
Took another - now more thorough - look at latest path. Here are two minor
remarks about this section of the code:

+        else if(err<0 || delay_frames > position - This->last_pos_frames)
+            /* Pulse bug: after an underrun, despite recovery, avail_frames
+             * may be larger than alsa_bufsize_frames, as if cumulating
frames. */

a) Signess issue. position and last_pos_frames are both unsigned, wouldn't we
hit an "undeflow" with flipping to a huge numbers (due to sign bit treated as a
part of unsigned value) in case position is less than last_pos_frames?

b) IMO aside from possible signess issues it'd be better to rewrite comparison
to this:

+        else if(err<0 || This->last_pos_frames > position - delay_frames)

In this form it'd be obvious from a first glance that we're clamping position
here to be at least last_pos_frames.

c) In comment you write about avail_frames which is not used for calculations
in surrounding code. Does the same bug affect delay_frames as well?

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list