[FFmpeg-devel] [PATCH] avdevice/alsa: fix indefinite stop on closing PCM capture

Lou Logan lou at lrcd.com
Mon Apr 22 21:44:43 EEST 2019


On Fri, 19 Apr 2019 10:54:26 -0800
Lou Logan <lou at lrcd.com> wrote:

> From 10800493523b9274e7cc8784b65cc183a94b7281 Mon Sep 17 00:00:00 2001
> From: Takayuki 'January June' Suwa <jjsuwa at sys3175.com>
> Date: Thu, 18 Apr 2019 10:56:40 +0900
> Subject: [PATCH] avdevice/alsa: fix indefinite stop on closing PCM capture
> 
> Sorry, I forgot to take recording into account...
> 
> Fixes:  https://bugs.archlinux.org/task/58619
> 
> Found-by: Elias (Bleuzen) https://bugs.archlinux.org/user/26956
> ---
>  libavdevice/alsa.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavdevice/alsa.c b/libavdevice/alsa.c
> index 1b21beb6d5..117b2ea144 100644
> --- a/libavdevice/alsa.c
> +++ b/libavdevice/alsa.c
> @@ -300,8 +300,10 @@ av_cold int ff_alsa_close(AVFormatContext *s1)
>  {
>      AlsaData *s = s1->priv_data;
>  
> -    snd_pcm_nonblock(s->h, 0);
> -    snd_pcm_drain(s->h);
> +    if (snd_pcm_stream(s->h) == SND_PCM_STREAM_PLAYBACK) {
> +        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);

Will push after 24 hours.


More information about the ffmpeg-devel mailing list