Submitted On 15-JUN-2005
John_Mulcahy
Perhaps related to this: there seems to be a bug in the blocking behaviour with JRE 5.0 when trying to read data during audio capture, if you use line.read and rely on blocking there will be occasional dropouts in the returned data (maybe every 10 seconds or so). Most reliable solution I have found is to have the capture task use the available() method to check the buffer status and let the task sleep until there is a block's worth of data to be read, so that the blocking behaviour is never required. That cured the dropouts for me.
Submitted On 28-JUL-2005
KlausJJ2
Maybe this is another problem. I tested recording with a a capture engine, which calls line.read(buf,offs,len) only if line.available() > 0 but I got the same errors.
Submitted On 28-JUL-2005
KlausJJ2
I think I located the problem in PLATFORM_API_WinOS_DirectSound.cpp (from JDK6.0b43):
res = info->captureBuffer->Lock(thisReadPos, byteSize,
(LPVOID *) &buffer1, &buffer1len,
(LPVOID *) &buffer2, &buffer2len,
0);
if (res != DS_OK) {
/* can't recover from error */
byteSize = 0;
}
Every time I get a dropout in my recording, the Lock method returns a value not equal to DS_OK.
Submitted On 01-AUG-2005
KlausJJ2
The variable thisReadPos is not reset to zero if it is equal to dsBufferSizeInBytes. The Lock method is then called with this value and returns an invalid param error DS_INVALIDPARAM.
The condidtion for the update read pos loop should be
thisReadPos >= info->dsBufferSizeInBytes instead of
thisReadPos > dsBufferSizeInBytes
There are no dropouts in my test recordings using this fix.
Submitted On 15-SEP-2005
KlausJJ2
I submitted a patch for Mustang to dev.java.net, but it would be nice to have the fix also in a Tiger update.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|