summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-09-04 13:56:23 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-09-04 13:56:23 +0000
commited507389e092cb117060112b3dfb77afc9bf20bc (patch)
tree204447c1843cb132b7a2528447679414c3c01136 /src
parent36b0d578629d766d708fa950d7157c775e177509 (diff)
downloadxine-lib-ed507389e092cb117060112b3dfb77afc9bf20bc.tar.gz
xine-lib-ed507389e092cb117060112b3dfb77afc9bf20bc.tar.bz2
still fighting the same bug. now i must have killed it :)
(unfortunately it takes hours of testing to reproduce...) CVS patchset: 5341 CVS date: 2003/09/04 13:56:23
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/audio_out.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index be37f71ac..0505b440f 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -17,7 +17,7 @@
* along with self program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_out.c,v 1.143 2003/09/04 00:21:09 miguelfreitas Exp $
+ * $Id: audio_out.c,v 1.144 2003/09/04 13:56:23 miguelfreitas Exp $
*
* 22-8-2001 James imported some useful AC3 sections from the previous alsa driver.
* (c) 2001 Andy Lo A Foe <andy@alsaplayer.org>
@@ -1681,6 +1681,9 @@ static void ao_flush (xine_audio_port_t *this_gen) {
/* do not try this in paused mode */
while( this->flush_audio_driver ) {
+ struct timeval tv;
+ struct timespec ts;
+
/* release mutex to get a buffer, otherwise a deadlock may happen */
pthread_mutex_unlock(&this->flush_audio_driver_lock);
buf = fifo_remove (this->free_fifo);
@@ -1689,7 +1692,15 @@ static void ao_flush (xine_audio_port_t *this_gen) {
buf->num_frames = 0;
buf->stream = NULL;
fifo_append (this->out_fifo, buf);
- pthread_cond_wait(&this->flush_audio_driver_reached, &this->flush_audio_driver_lock);
+
+ /* cond_timedwait was not supposed be needed here, but somehow it may still
+ * get stuck when using normal cond_wait. probably the signal is missed when
+ * we release the mutex above.
+ */
+ gettimeofday(&tv, NULL);
+ ts.tv_sec = tv.tv_sec + 1;
+ ts.tv_nsec = tv.tv_usec * 1000;
+ pthread_cond_timedwait(&this->flush_audio_driver_reached, &this->flush_audio_driver_lock, &ts);
}
this->discard_buffers--;