[maemo-commits] [maemo-commits] r19053 - in projects/haf/trunk/libsdl-mixer1.2: . debian
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Aug 5 19:04:49 EEST 2009
- Previous message: [maemo-commits] r19052 - projects/haf/trunk/hildon-welcome/src
- Next message: [maemo-commits] r19054 - projects/haf/tags/libsdl-mixer1.2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: csaavedra Date: 2009-08-05 19:04:34 +0300 (Wed, 05 Aug 2009) New Revision: 19053 Modified: projects/haf/trunk/libsdl-mixer1.2/debian/changelog projects/haf/trunk/libsdl-mixer1.2/mixer.c projects/haf/trunk/libsdl-mixer1.2/music.c Log: ibsdl-mixer1.2 (1.2.6-5) unstable; urgency=low * Do not poll libcanberra unnecessarily (?\195?\129dam Endrodi) + Fixes: NB#120434 -- Claudio Saavedra <csaavedra at igalia.com> Wed, 05 Aug 2009 17:44:00 +0200 Modified: projects/haf/trunk/libsdl-mixer1.2/debian/changelog =================================================================== --- projects/haf/trunk/libsdl-mixer1.2/debian/changelog 2009-08-05 12:03:25 UTC (rev 19052) +++ projects/haf/trunk/libsdl-mixer1.2/debian/changelog 2009-08-05 16:04:34 UTC (rev 19053) @@ -1,3 +1,10 @@ +libsdl-mixer1.2 (1.2.6-5) unstable; urgency=low + + * Do not poll libcanberra unnecessarily (Ádam Endrodi) + + Fixes: NB#120434 + + -- Claudio Saavedra <csaavedra at igalia.com> Wed, 05 Aug 2009 17:44:00 +0200 + libsdl-mixer1.2 (1.2.6-4) unstable; urgency=low * Fixed several warnings. Fixes: NB#50264 Modified: projects/haf/trunk/libsdl-mixer1.2/mixer.c =================================================================== --- projects/haf/trunk/libsdl-mixer1.2/mixer.c 2009-08-05 12:03:25 UTC (rev 19052) +++ projects/haf/trunk/libsdl-mixer1.2/mixer.c 2009-08-05 16:04:34 UTC (rev 19053) @@ -75,6 +75,15 @@ static int num_channels; static int reserved_channels = 0; +/* + * These defined in libsdl for us. SDL_mixer_lock is only touched by + * mix_channels() to avoid deadlock. SDL_mixer_blocker is increased + * whenever new samples are added to a channel and decreased when a + * channel finished playing. mix_channels() use this semaphor to + * wait until new samples are available. + */ +extern SDL_mutex *SDL_mixer_lock; +extern SDL_sem *SDL_mixer_blocker; /* Support for hooking into the mixer callback system */ static void (*mix_postmix)(void *udata, Uint8 *stream, int len) = NULL; @@ -120,6 +129,11 @@ * inside audio callback. */ _Mix_remove_all_effects(channel, &mix_channel[channel].effects); + + /* Remove one bunch of samples from the pile and if these were + * the last ones make mix_channels() wait for new supply. + * Use TryWait just in case we screwed up to not block here. */ + SDL_SemTryWait(SDL_mixer_blocker); } @@ -161,6 +175,18 @@ /* Mix the music (must be done before the channels are added) */ if ( music_active || (mix_music != music_mixer) ) { mix_music(music_data, stream, len); + } else { + /* + * Block until new samples to mix appear. libsdl has locked + * SDL_mixer_lock but we cannot block while it is held + * (it would prevent the addition of new samples), so + * let's unlock it for the time being. I think even + * theoretically correct. + */ + SDL_mutexV(SDL_mixer_lock); + SDL_SemWait(SDL_mixer_blocker); + SDL_SemPost(SDL_mixer_blocker); + SDL_mutexP(SDL_mixer_lock); } /* Mix any playing channels... */ @@ -697,6 +723,9 @@ mix_channel[which].fading = MIX_NO_FADING; mix_channel[which].start_time = sdl_ticks; mix_channel[which].expire = (ticks>0) ? (sdl_ticks + ticks) : 0; + + /* Wake up mix_channels(). */ + SDL_SemPost(SDL_mixer_blocker); } } SDL_UnlockAudio(); @@ -770,6 +799,9 @@ mix_channel[which].fade_length = (Uint32)ms; mix_channel[which].start_time = mix_channel[which].ticks_fade = sdl_ticks; mix_channel[which].expire = (ticks > 0) ? (sdl_ticks+ticks) : 0; + + /* Wake up mix_channels(). */ + SDL_SemPost(SDL_mixer_blocker); } } SDL_UnlockAudio(); Modified: projects/haf/trunk/libsdl-mixer1.2/music.c =================================================================== --- projects/haf/trunk/libsdl-mixer1.2/music.c 2009-08-05 12:03:25 UTC (rev 19052) +++ projects/haf/trunk/libsdl-mixer1.2/music.c 2009-08-05 16:04:34 UTC (rev 19053) @@ -90,7 +90,7 @@ static SDL_AudioSpec used_mixer; #endif -int volatile music_active = 1; +int volatile music_active = 0; static int volatile music_stopped = 0; static int music_loops = 0; static char *music_cmd = NULL;
- Previous message: [maemo-commits] r19052 - projects/haf/trunk/hildon-welcome/src
- Next message: [maemo-commits] r19054 - projects/haf/tags/libsdl-mixer1.2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]