On Tue, Jan 27, 2009 at 07:38:24PM +0000, Jacob Meuser wrote: > On Tue, Jan 27, 2009 at 06:50:53PM +0000, Edd Barrett wrote: > > On Sun, Jan 25, 2009 at 06:02:38PM +0100, Jonathan Armani wrote: > > > Hi, > > > > > > This patch update teeworlds to the last version and split it : > > > > > > -main both client and data > > > -server which permit to run it without X installed > > > -maps required by both client and server > > > > > > Thanks to ajacoutot@ for the advices and Fabien Romano for testing. > > > > The newest SDL port causes this game to seg fault on my system. Do you > > guys see this behavior? > > > > It worked before with bad jumpy sound (same issue as openarena), which > > is why I decided to try updating SDL (as I knew work was happening in > > this area). > > > > I will CC in jakemsr, as he did some bits on SDL sound recently. > > hmm, I missed testing this one as it went in after I made the list > of SDL using ports. > > it segfaults here. but the initial backtrace points to GL issues: > > #0 0x03eabb94 in glGenTextures () from /usr/X11R6/lib/libGL.so.8.0 > No symbol table info available. > > I'll rebuild with debugging and see if I can get better info.
ick. static void mix(short *final_out, unsigned frames) { int mix_buffer[MAX_FRAMES*2]; ... for(i = 0; i < frames; i++) { int j = i<<1; int vl = ((mix_buffer[j]*master_vol)/101)>>8; nowhere is there any check to make sure j < MAX_FRAMES*2. interestingly MAX_FRAMES is only used in that one place. so why is it used with *2? maybe this is a clue: format.samples = 512; /* A good value for games */ kinda looks like the author is just guessing. anyway, patch below stops the segfault. the audio is still a little choppy though. bumping format.samples would probably help, but that value should really be derived from the timing considerations of the program, not simply guessed at. -- jake...@sdf.lonestar.org SDF Public Access UNIX System - http://sdf.lonestar.org $OpenBSD$ --- src/engine/client/ec_snd.c.orig Tue Jan 27 11:41:17 2009 +++ src/engine/client/ec_snd.c Tue Jan 27 12:30:08 2009 @@ -139,10 +139,19 @@ static int iabs(int i) static void mix(short *final_out, unsigned frames) { - int mix_buffer[MAX_FRAMES*2] = {0}; - int i, s; + int *mix_buffer; + int i, s, mix_buffer_size; int master_vol; + mix_buffer_size = frames * 2 * sizeof(int); + mix_buffer = (int *)malloc(mix_buffer_size); + if (mix_buffer == NULL) + { + printf("malloc failed"); + return; + } + bzero(mix_buffer, mix_buffer_size); + /* aquire lock while we are mixing */ lock_wait(sound_lock); @@ -239,6 +248,12 @@ static void mix(short *final_out, unsigned frames) #if defined(CONF_ARCH_ENDIAN_BIG) swap_endian(final_out, sizeof(short), frames * 2); #endif + + if(mix_buffer != NULL) { + free(mix_buffer); + mix_buffer = NULL; + } + } static void sdlcallback(void *unused, Uint8 *stream, int len)