* Use the older fragments API for setting the driver buffer size,
since it gives much more fine grained control. * Use a smaller buffer on Haiku, this will give some slight clicks when something is going on (for example launching Firefox), but should be bearable. The reduced latency is otherwise quite nice and VLC works again which outweights the seldom clicks. Obviously the best is to find and fix scheduler problems, but in the meantime, this may be more helpful to people. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27382 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -96,38 +96,29 @@ status_t OpenSoundDeviceEngine::Open(int mode)
|
|||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set latency policy = fragment size and total driver buffer size
|
// set driver buffer size by using the "fragments" API
|
||||||
// TODO: export this setting as a BParameter?
|
// TODO: export this setting as a BParameter?
|
||||||
|
|
||||||
// NOTE stippi: 4 means 2048 bytes driver buffer in my tests on a C-Media
|
// NOTE stippi: 2048 bytes driver buffer is long enough for playback on
|
||||||
// This latency is long enough for playback on BeOS. On Haiku, testing on
|
// BeOS. On Haiku, testing on HD Audio hardware, it is too short. However,
|
||||||
// HD Audio hardware, it is too short. However, I seem to remember the
|
// I seem to remember the HD Audio supports 32 bit sample width (while
|
||||||
// HD Audio supports 32 bit sample width (while C-Media supports "only"
|
// C-Media supports "only" 16). If OSS uses the same 2048 bytes even for
|
||||||
// 16). If OSS uses the same 2048 bytes even for 32 bit/sample, then I
|
// 32 bit/sample, then I could see how that would be asking for too much,
|
||||||
// could see how that would be asking for too much, since that would
|
// since that would effectively half the latency.
|
||||||
// effectively half the latency.
|
|
||||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||||
v = 5;
|
uint32 bufferCount = 6;
|
||||||
|
uint32 bufferSize = 0x000b; // 1024 bytes
|
||||||
#else
|
#else
|
||||||
v = 4;
|
uint32 bufferCount = 4;
|
||||||
|
uint32 bufferSize = 0x000a; // 512 bytes
|
||||||
#endif
|
#endif
|
||||||
if (ioctl(fFD, SNDCTL_DSP_POLICY, &v, sizeof(int)) < 0) {
|
v = (bufferCount << 16) | bufferSize;
|
||||||
if (errno != EIO && errno != EINVAL) {
|
|
||||||
fInitCheckStatus = errno;
|
|
||||||
Close();
|
|
||||||
return EIO;
|
|
||||||
}
|
|
||||||
// TODO: use this older API as fallback:
|
|
||||||
#if 0
|
|
||||||
// set fragments
|
|
||||||
v = 0x7fff0000 | 0x000b; // unlimited * 2048
|
|
||||||
if (ioctl(fFD, SNDCTL_DSP_SETFRAGMENT, &v, sizeof(int)) < 0) {
|
if (ioctl(fFD, SNDCTL_DSP_SETFRAGMENT, &v, sizeof(int)) < 0) {
|
||||||
fInitCheckStatus = errno;
|
fInitCheckStatus = errno;
|
||||||
Close();
|
Close();
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
fDriverBufferSize = 2048;
|
fDriverBufferSize = 2048;
|
||||||
// preliminary, adjusted in AcceptFormat()
|
// preliminary, adjusted in AcceptFormat()
|
||||||
|
|||||||
Reference in New Issue
Block a user