From e1019bfd4706a9ab58e68c33e4c4d8aae2489557 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 19 Dec 2004 20:24:30 +0000 Subject: stop stream if audio device failed to open. user receives a notification and should check if any other application is using the device. CVS patchset: 7282 CVS date: 2004/12/19 20:24:30 --- src/xine-engine/audio_out.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/xine-engine/audio_out.c') diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index e8c852091..e9414ced9 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.188 2004/12/12 22:01:30 mroi Exp $ + * $Id: audio_out.c,v 1.189 2004/12/19 20:24:30 miguelfreitas Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe @@ -1047,10 +1047,10 @@ static void *ao_loop (void *this_gen) { pthread_mutex_lock(&this->streams_lock); for (stream = xine_list_first_content(this->streams); stream; stream = xine_list_next_content(this->streams)) { - _x_message (stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL); - /* This is necessary for the message to get to the front-end at some - * point before another message is sent */ - sched_yield(); + if( !stream->emergency_brake ) { + stream->emergency_brake = 1; + _x_message (stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL); + } } pthread_mutex_unlock(&this->streams_lock); } @@ -1399,8 +1399,14 @@ static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream, pthread_mutex_lock( &this->driver_lock ); ret = ao_change_settings(this, bits, rate, mode); pthread_mutex_unlock( &this->driver_lock ); - if( !ret ) + + if( !ret ) { + if( !stream->emergency_brake ) { + stream->emergency_brake = 1; + _x_message (stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL); + } return 0; + } } /* -- cgit v1.2.3