src/osd/sdl/sound.c
| r911 | r912 | |
| 391 | 391 | //============================================================ |
| 392 | 392 | void sdl_callback(void *userdata, Uint8 *stream, int len) |
| 393 | 393 | { |
| 394 | | int len1, len2; |
| 394 | int len1, len2, sb_in; |
| 395 | 395 | |
| 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)) |
| 398 | 401 | { |
| 399 | 402 | #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); |
| 405 | 404 | #endif |
| 406 | | len1 = stream_buffer_in - stream_playpos; |
| 407 | | len2 = 0; |
| 405 | return; |
| 408 | 406 | } |
| 409 | 407 | else if ((stream_playpos+len) > stream_buffer_size) |
| 410 | 408 | { |