summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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--;