summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
authorMatthias Kretz <kretz@kde.org>2007-06-04 23:30:16 +0200
committerMatthias Kretz <kretz@kde.org>2007-06-04 23:30:16 +0200
commit7fc8916e6231e4cd7ed55c0fc7423f1ff705e497 (patch)
tree11a3b9f038422b8b4e2d09b50c6632912a226e76 /src/xine-engine
parentf022bad42861429cac5c56c575b54819ba092b98 (diff)
downloadxine-lib-7fc8916e6231e4cd7ed55c0fc7423f1ff705e497.tar.gz
xine-lib-7fc8916e6231e4cd7ed55c0fc7423f1ff705e497.tar.bz2
handle unplugged devices in audio_alsa_out (return -1) and in audio_out close the driver on a return value <0
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/audio_out.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index d39c99aba..fddae2dfe 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -1211,13 +1211,15 @@ static void *ao_loop (void *this_gen) {
}
if( result < 0 ) {
- /* FIXME: USB device unplugged.
- * We should get the card into a closed state here, that involves closing
- * the PCM as well as the MIXER.
- * Maybe we should pause the stream until the USB device is plugged in again.
- * Return values 0 happen even if usb not unplugged, so needs further investigation.
- */
- xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Was a USB device unplugged ?\n"));
+ /* device unplugged. */
+ xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Assuming the device was unplugged.\n"));
+
+ pthread_mutex_lock( &this->driver_lock );
+ if(this->driver_open)
+ this->driver->close(this->driver);
+ this->driver_open = 0;
+ pthread_mutex_unlock( &this->driver_lock );
+ /* closing the driver will result in XINE_MSG_AUDIO_OUT_UNAVAILABLE to be emitted */
}
lprintf ("loop: next buf from fifo\n");