static gint
xrun_recovery (GstAlsaSink * alsa, snd_pcm_t * handle, gint err)
{
- GST_DEBUG_OBJECT (alsa, "xrun recovery %d", err);
+ GST_DEBUG_OBJECT (alsa, "xrun recovery %d: %s", err, g_strerror (err));
if (err == -EPIPE) { /* under-run */
err = snd_pcm_prepare (handle);
GST_DEBUG_OBJECT (asink, "Write error: %s", snd_strerror (err));
if (err == -EAGAIN) {
continue;
+ } else if (err == -ENODEV) {
+ goto device_disappeared;
} else if (xrun_recovery (alsa, alsa->handle, err) < 0) {
goto write_error;
}
GST_ALSA_SINK_UNLOCK (asink);
return length; /* skip one period */
}
+device_disappeared:
+ {
+ GST_ELEMENT_ERROR (asink, RESOURCE, WRITE,
+ (_("Error outputting to audio device. "
+ "The device has been disconnected.")), (NULL));
+ goto write_error;
+ }
}
static guint
static gint
xrun_recovery (GstAlsaSrc * alsa, snd_pcm_t * handle, gint err)
{
- GST_DEBUG_OBJECT (alsa, "xrun recovery %d", err);
+ GST_DEBUG_OBJECT (alsa, "xrun recovery %d: %s", err, g_strerror (err));
if (err == -EPIPE) { /* under-run */
err = snd_pcm_prepare (handle);
if (err == -EAGAIN) {
GST_DEBUG_OBJECT (asrc, "Read error: %s", snd_strerror (err));
continue;
+ } else if (err == -ENODEV) {
+ goto device_disappeared;
} else if (xrun_recovery (alsa, alsa->handle, err) < 0) {
goto read_error;
}
GST_ALSA_SRC_UNLOCK (asrc);
return length; /* skip one period */
}
+device_disappeared:
+ {
+ GST_ELEMENT_ERROR (asrc, RESOURCE, READ,
+ (_("Error recording from audio device. "
+ "The device has been disconnected.")), (NULL));
+ goto read_error;
+ }
}
static guint