diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-06-22 15:33:56 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-07-09 16:00:56 -0400 |
commit | 8bfd7f6a475225a0595bf657f8b99a8fffb461e4 (patch) | |
tree | 8d61a013d2bddda4a51267b9c029d464f940d008 | |
parent | 4c98976124f611b1a475bccb1b5177ff536be79c (diff) | |
download | ffmpeg-8bfd7f6a475225a0595bf657f8b99a8fffb461e4.tar.gz |
alsa: fallback to buffer_size/4 for period_size.
buffer_size/4 is the value used by aplay. This fixes output to null
devices, e.g. writing ALSA output to a file.
-rw-r--r-- | libavdevice/alsa-audio-common.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c index 4cfc6e9864..1e945fc389 100644 --- a/libavdevice/alsa-audio-common.c +++ b/libavdevice/alsa-audio-common.c @@ -269,6 +269,8 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode, } snd_pcm_hw_params_get_period_size_min(hw_params, &period_size, NULL); + if (!period_size) + period_size = buffer_size / 4; res = snd_pcm_hw_params_set_period_size_near(h, hw_params, &period_size, NULL); if (res < 0) { av_log(ctx, AV_LOG_ERROR, "cannot set ALSA period size (%s)\n", |