diff --git a/swfdec-gtk/swfdec_playback_alsa.c b/swfdec-gtk/swfdec_playback_alsa.c index f4711e9..e1af2de 100644 --- a/swfdec-gtk/swfdec_playback_alsa.c +++ b/swfdec-gtk/swfdec_playback_alsa.c @@ -105,6 +105,8 @@ write_player (Stream *stream, const snd_pcm_channel_area_t *dst, return rendered; } +static void swfdec_playback_stream_start (Stream *stream); + static gboolean try_write_mmap (Stream *stream) { @@ -114,6 +116,10 @@ try_write_mmap (Stream *stream) do { avail_result = snd_pcm_avail_update (stream->pcm); + if (avail_result == -EPIPE) { + swfdec_playback_stream_start (stream); + return TRUE; + } ALSA_ERROR (avail_result, "snd_pcm_avail_update failed", FALSE); if (avail_result == 0) return TRUE; @@ -142,6 +148,10 @@ try_write_so_pa_gets_it (Stream *stream) gboolean finish = FALSE; avail = snd_pcm_avail_update (stream->pcm); + if (avail == -EPIPE) { + swfdec_playback_stream_start (stream); + return TRUE; + } ALSA_ERROR (avail, "snd_pcm_avail_update failed", FALSE); while (avail > 0 && !finish) { @@ -165,7 +175,6 @@ try_write_so_pa_gets_it (Stream *stream) #define try_write(stream) ((stream)->write (stream)) -static void swfdec_playback_stream_start (Stream *stream); static gboolean handle_stream (GIOChannel *source, GIOCondition cond, gpointer data) {