Previous 15994 Revisions Next

r912 Saturday 1st September, 2007 at 18:42:10 UTC by R. Belmont
[SDLMESS] Fix crash from new sound code (enik).
[src/osd/sdl]sound.c

src/osd/sdl/sound.c
r911r912
391391//============================================================
392392void sdl_callback(void *userdata, Uint8 *stream, int len)
393393{
394   int len1, len2;
394   int len1, len2, sb_in;
395395
396   if (stream_in_initialized == 1 && stream_loop == 0
397       && (stream_playpos+len) > stream_buffer_in)
396   sb_in = stream_buffer_in;
397   if (stream_loop)
398      sb_in += stream_buffer_size;
399
400   if (sb_in < (stream_playpos+len))
398401   {
399402#if LOG_SOUND
400      // I solved a crash by comment out a printf at sdl_callback. so
401      // I think this fprintf could cause a crash too (well, it works
402      // fine to me) if output is slow and sdl_callback is called
403      // again before exit the function (could be possible?).
404      //fprintf(sound_log, "Underflow at sdl_callback: SPP=%d  SBI=%d  Len=%d\n", (int)stream_playpos, (int)stream_buffer_in, (int)len);
403      fprintf(sound_log, "Underflow at sdl_callback: SPP=%d SBI=%d(%d) Len=%d\n", (int)stream_playpos, (int)sb_in, (int)stream_buffer_in, (int)len);
405404#endif
406      len1 = stream_buffer_in - stream_playpos;
407      len2 = 0;
405      return;
408406   }
409407   else if ((stream_playpos+len) > stream_buffer_size)
410408   {

Previous 15994 Revisions Next


© 1998-2018 The MESS Team