avdevice/alsa: wait until playback buffers are drained before closing
authorTakayuki 'January June' Suwa <jjsuwa.sys3175@gmail.com>
Sat, 6 May 2017 11:42:56 +0000 (20:42 +0900)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 6 May 2017 21:54:26 +0000 (23:54 +0200)
This fixes early abort on ALSA playback

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavdevice/alsa.c

index 8d27913..1bbff30 100644 (file)
@@ -300,6 +300,8 @@ av_cold int ff_alsa_close(AVFormatContext *s1)
 {
     AlsaData *s = s1->priv_data;
 
+    snd_pcm_nonblock(s->h, 0);
+    snd_pcm_drain(s->h);
     av_freep(&s->reorder_buf);
     if (CONFIG_ALSA_INDEV)
         ff_timefilter_destroy(s->timefilter);