[squeak-dev] Building (Linux) VM - with segfaults. that point to
audio
Brad Fuller
bradallenfuller at gmail.com
Tue Nov 18 18:22:36 UTC 2008
The problem might be that arrayIndex is 32bit and it is used to
calculate *samples which is 64bit. This would be a problem if
arrayIndex has bit31 set.
EXAMPLE: If arrayIndex comes in with bit31 set (e.g. 0x911f13fc),
which is negative, the top bit is extended when *samples is
calculated. samples becomes 0xffffffff911f13fc.(actual values while
debugging)
Perhaps the cast (void *)arrayIndex was to fix that.
Here's the function... I'm referencing lines 5 and 6 of the function:
====================
1 static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt
arrayIndex, sqInt startIndex)
2 {
3 if (output_handle)
4 {
5 void *samples= (void *)arrayIndex + startIndex * output_channels * 2;
6 int count= snd_pcm_writei(output_handle, samples, frameCount);
7 if (count < frameCount / 2)
8 {
9 output_buffer_frames_available= 0;
}
if (count < 0)
{
if (count == -EPIPE) /* underrun */
{
int err;
snd(pcm_prepare(output_handle), "sound_PlaySamples: snd_pcm_prepare");
return 0;
}
fprintf(stderr, "snd_pcm_writei returned %i\n", count);
return 0;
}
return count;
}
success(false);
============
Does that seem right to you all?
Maybe sqInt never gets to be long long? sqMemoryAccess.h defines:
#if defined(SQ_IMAGE32)
typedef int sqInt;
typedef unsigned int usqInt;
#elif defined(SQ_HOST64)
typedef long sqInt;
typedef unsigned long usqInt;
#else
# if (SIZEOF_LONG_LONG != 8)
# error long long integers are not 64-bits wide?
# endif
typedef long long sqInt;
typedef unsigned long long usqInt;
#endif
--
Brad Fuller
More information about the Squeak-dev
mailing list
|