diff --git a/media-libs/libsdl/patches/libsdl-1.2.15.patchset b/media-libs/libsdl/patches/libsdl-1.2.15.patchset index a4ad501e2..b4adbd8ae 100644 --- a/media-libs/libsdl/patches/libsdl-1.2.15.patchset +++ b/media-libs/libsdl/patches/libsdl-1.2.15.patchset @@ -146,3 +146,57 @@ index c32b661..a26f18b 100644 -- 1.8.3.4 + +From b0294206194d97e8bb8a69a214e4c8bd3311ed03 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sat, 23 Nov 2013 11:59:00 +0100 +Subject: Actually fix the sample vs bytes problem in audio driver. + + +diff --git a/src/audio/baudio/SDL_beaudio.cc b/src/audio/baudio/SDL_beaudio.cc +index 7faf571..300bf03 100644 +--- a/src/audio/baudio/SDL_beaudio.cc ++++ b/src/audio/baudio/SDL_beaudio.cc +@@ -161,25 +161,30 @@ int BE_OpenAudio(_THIS, SDL_AudioSpec *spec) + format.byte_order = B_MEDIA_LITTLE_ENDIAN; + format.frame_rate = (float) spec->freq; + format.channel_count = spec->channels; /* !!! FIXME: support > 2? */ ++ int samplesize = 1; + while ((!valid_datatype) && (test_format)) { + valid_datatype = 1; + spec->format = test_format; + switch (test_format) { + case AUDIO_S8: + format.format = media_raw_audio_format::B_AUDIO_CHAR; ++ samplesize = 1; + break; + + case AUDIO_U8: + format.format = media_raw_audio_format::B_AUDIO_UCHAR; ++ samplesize = 1; + break; + + case AUDIO_S16LSB: + format.format = media_raw_audio_format::B_AUDIO_SHORT; ++ samplesize = 2; + break; + + case AUDIO_S16MSB: + format.format = media_raw_audio_format::B_AUDIO_SHORT; + format.byte_order = B_MEDIA_BIG_ENDIAN; ++ samplesize = 2; + break; + + default: +@@ -202,7 +207,7 @@ int BE_OpenAudio(_THIS, SDL_AudioSpec *spec) + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + +- format.buffer_size = spec->samples; ++ format.buffer_size = spec->samples * spec->channels * samplesize; + + /* Subscribe to the audio stream (creates a new thread) */ + { sigset_t omask; +-- +1.8.3.4 +