[maemo-commits] [maemo-commits] r19055 - in projects/haf/trunk/libsdl1.2/debian: . patches

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Aug 5 19:06:20 EEST 2009
Author: csaavedra
Date: 2009-08-05 19:06:15 +0300 (Wed, 05 Aug 2009)
New Revision: 19055

Added:
   projects/haf/trunk/libsdl1.2/debian/patches/330_pulseaudio_tease.diff
Modified:
   projects/haf/trunk/libsdl1.2/debian/changelog
   projects/haf/trunk/libsdl1.2/debian/patches/series
Log:
libsdl1.2 (1:1.2.13-2maemo5) unstable; urgency=low

  * debian/patches/330_pulseaudio_no_tease.diff
    + Added (?\195?\129dam Endrodi)
    + Fixes: NB#120434 (SDL to libcanberra (was: constant CPU usage but no
    playback))

 -- Claudio Saavedra <csaavedra at igalia.com>  Wed, 05 Aug 2009 17:24:18 +0200



Modified: projects/haf/trunk/libsdl1.2/debian/changelog
===================================================================
--- projects/haf/trunk/libsdl1.2/debian/changelog	2009-08-05 16:05:42 UTC (rev 19054)
+++ projects/haf/trunk/libsdl1.2/debian/changelog	2009-08-05 16:06:15 UTC (rev 19055)
@@ -1,3 +1,12 @@
+libsdl1.2 (1:1.2.13-2maemo5) unstable; urgency=low
+
+  * debian/patches/330_pulseaudio_no_tease.diff
+    + Added (Ádam Endrodi)
+    + Fixes: NB#120434 (SDL to libcanberra (was: constant CPU usage but no
+    playback))
+
+ -- Claudio Saavedra <csaavedra at igalia.com>  Wed, 05 Aug 2009 17:24:18 +0200
+
 libsdl1.2 (1:1.2.13-2maemo4) unstable; urgency=low
 
   * debian/patches/320_no_fullscreen_grab.diff

Added: projects/haf/trunk/libsdl1.2/debian/patches/330_pulseaudio_tease.diff
===================================================================
--- projects/haf/trunk/libsdl1.2/debian/patches/330_pulseaudio_tease.diff	2009-08-05 16:05:42 UTC (rev 19054)
+++ projects/haf/trunk/libsdl1.2/debian/patches/330_pulseaudio_tease.diff	2009-08-05 16:06:15 UTC (rev 19055)
@@ -0,0 +1,89 @@
+Index: SDL-1.2.13/src/audio/SDL_audio.c
+===================================================================
+--- SDL-1.2.13.orig/src/audio/SDL_audio.c	2009-08-05 18:21:51.000000000 +0300
++++ SDL-1.2.13/src/audio/SDL_audio.c	2009-08-05 18:22:15.000000000 +0300
+@@ -117,6 +117,20 @@
+ };
+ SDL_AudioDevice *current_audio = NULL;
+ 
++/*
++ * Synchronization objects that need to be accessible in libsdlmixer.
++ *
++ * SDL_mixer_lock:
++ *	Which will be current_audio->mixer_lock.
++ * SDL_mixer_blocker:
++ *	Used by libsdlmixer in the audio thread to implement blocking,
++ *	and by us to unblock it.
++ *
++ * Curiously gcc seems to assume private visibility, so let's override it.
++ */
++SDL_mutex *SDL_mixer_lock __attribute__((visibility("default")));
++SDL_sem *SDL_mixer_blocker __attribute__((visibility("default")));
++
+ /* Various local functions */
+ int SDL_AudioInit(const char *driver_name);
+ void SDL_AudioQuit(void);
+@@ -176,7 +190,6 @@
+ 
+ 	/* Loop, filling the audio buffers */
+ 	while ( audio->enabled ) {
+-
+ 		/* Fill the current buffer with sound */
+ 		if ( audio->convert.needed ) {
+ 			if ( audio->convert.buf ) {
+@@ -197,6 +210,12 @@
+ 			SDL_mutexP(audio->mixer_lock);
+ 			(*fill)(udata, stream, stream_len);
+ 			SDL_mutexV(audio->mixer_lock);
++
++			/* As fill() may block we have to recheck the flags
++			 * and pretend we did the right thing. */
++			if ( ! audio->enabled || audio->paused) {
++				SDL_memset(stream, silence, stream_len);
++			}
+ 		}
+ 
+ 		/* Convert the audio if necessary */
+@@ -478,12 +497,13 @@
+ 	/* Uses interrupt driven audio, without thread */
+ #else
+ 	/* Create a semaphore for locking the sound buffers */
+-	audio->mixer_lock = SDL_CreateMutex();
++	audio->mixer_lock = SDL_mixer_lock = SDL_CreateMutex();
+ 	if ( audio->mixer_lock == NULL ) {
+ 		SDL_SetError("Couldn't create mixer lock");
+ 		SDL_CloseAudio();
+ 		return(-1);
+ 	}
++	SDL_mixer_blocker = SDL_CreateSemaphore(0);
+ #endif /* SDL_THREADS_DISABLED */
+ 
+ 	/* Calculate the silence and size of the audio specification */
+@@ -626,10 +646,14 @@
+ 	if ( audio ) {
+ 		audio->enabled = 0;
+ 		if ( audio->thread != NULL ) {
++			/* Unblock libsdlmixer, so SDL_RunAudio
++			 * can return. */
++			SDL_SemPost(SDL_mixer_blocker);
+ 			SDL_WaitThread(audio->thread, NULL);
+ 		}
+ 		if ( audio->mixer_lock != NULL ) {
+ 			SDL_DestroyMutex(audio->mixer_lock);
++			SDL_mixer_lock = NULL;
+ 		}
+ 		if ( audio->fake_stream != NULL ) {
+ 			SDL_FreeAudioMem(audio->fake_stream);
+@@ -642,6 +666,12 @@
+ 			audio->CloseAudio(audio);
+ 			audio->opened = 0;
+ 		}
++		if ( SDL_mixer_blocker ) {
++			/* The thread has finished, so it is safe
++			 * to destroy it. */
++			SDL_DestroySemaphore(SDL_mixer_blocker);
++			SDL_mixer_blocker = NULL;
++		}
+ 		/* Free the driver data */
+ 		audio->free(audio);
+ 		current_audio = NULL;

Modified: projects/haf/trunk/libsdl1.2/debian/patches/series
===================================================================
--- projects/haf/trunk/libsdl1.2/debian/patches/series	2009-08-05 16:05:42 UTC (rev 19054)
+++ projects/haf/trunk/libsdl1.2/debian/patches/series	2009-08-05 16:06:15 UTC (rev 19055)
@@ -22,3 +22,4 @@
 300_dont_propagate_lpthread.diff
 310_fix_marbles.diff
 320_no_fullscreen_grab.diff
+330_pulseaudio_tease.diff

More information about the maemo-commits mailing list