Mercurial > audlegacy
changeset 1275:847d9a218f66 trunk
[svn] - use mutex locking to make alsa stay happy with dmix
author | nenolod |
---|---|
date | Fri, 16 Jun 2006 02:35:49 -0700 |
parents | d7d7037fc583 |
children | e43225462cdc |
files | ChangeLog Plugins/Output/alsa/alsa.c Plugins/Output/alsa/alsa.h Plugins/Output/alsa/audio.c Plugins/Output/alsa/init.c |
diffstat | 5 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Jun 16 02:24:10 2006 -0700 +++ b/ChangeLog Fri Jun 16 02:35:49 2006 -0700 @@ -1,3 +1,12 @@ +2006-06-16 09:24:10 +0000 George Averill <nhjm449@gmail.com> + revision [1462] + - Buffer indicator support for vorbis. + + + Changes: Modified: + +6 -1 trunk/Plugins/Input/vorbis/http.c + + 2006-06-16 09:17:33 +0000 George Averill <nhjm449@gmail.com> revision [1460] - Support for the buffer indicator in playpaus.png that was apparently
--- a/Plugins/Output/alsa/alsa.c Fri Jun 16 02:24:10 2006 -0700 +++ b/Plugins/Output/alsa/alsa.c Fri Jun 16 02:35:49 2006 -0700 @@ -63,4 +63,8 @@ free(alsa_cfg.mixer_device); alsa_cfg.mixer_device = NULL; } + + /* release our mutex */ + g_mutex_free(alsa_mutex); + alsa_mutex = NULL; }
--- a/Plugins/Output/alsa/alsa.h Fri Jun 16 02:24:10 2006 -0700 +++ b/Plugins/Output/alsa/alsa.h Fri Jun 16 02:35:49 2006 -0700 @@ -82,4 +82,6 @@ int alsa_get_written_time(void); void alsa_tell(AFormat * fmt, gint * rate, gint * nch); +extern GMutex *alsa_mutex; + #endif
--- a/Plugins/Output/alsa/audio.c Fri Jun 16 02:24:10 2006 -0700 +++ b/Plugins/Output/alsa/audio.c Fri Jun 16 02:35:49 2006 -0700 @@ -64,6 +64,7 @@ static gboolean pause_request; /* pause status currently requested */ static int flush_request; /* flush status (time) currently requested */ static int prebuffer_size; +static GMutex *alsa_mutex; static guint mixer_timeout; @@ -256,6 +257,8 @@ if (!going) return; + g_mutex_lock(alsa_mutex); + debug("Closing device"); going = 0; @@ -278,6 +281,8 @@ if (alsa_cfg.debug) snd_output_close(logs); debug("Device closed"); + + g_mutex_unlock(alsa_mutex); } /* reopen ALSA PCM */ @@ -802,6 +807,8 @@ struct pollfd *pfds; unsigned short *revents; + g_mutex_lock(alsa_mutex); + if (npfds <= 0) goto _error; pfds = alloca(sizeof(*pfds) * npfds); @@ -847,6 +854,7 @@ } _error: + g_mutex_unlock(alsa_mutex); alsa_close_pcm(); g_free(thread_buffer); thread_buffer = NULL; @@ -870,6 +878,8 @@ return 0; } + g_mutex_lock(alsa_mutex); + if (!mixer) alsa_setup_mixer(); @@ -896,6 +906,8 @@ wr_index = rd_index = 0; pause_request = FALSE; flush_request = -1; + + g_mutex_unlock(alsa_mutex); audio_thread = g_thread_create((GThreadFunc)alsa_loop, NULL, TRUE, NULL); return 1;