[FFmpeg-cvslog] alsa: fallback to buffer_size/4 for period_size.

Justin Ruggles git at videolan.org
Thu Sep 22 01:17:21 CEST 2011


ffmpeg | branch: release/0.8 | Justin Ruggles <justin.ruggles at gmail.com> | Wed Jun 22 15:33:56 2011 -0400| [9bf76932e5e4dffd5199084cab810b6c8203fce1] | committer: Anton Khirnov

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.
(cherry picked from commit 8bfd7f6a475225a0595bf657f8b99a8fffb461e4)

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9bf76932e5e4dffd5199084cab810b6c8203fce1
---

 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 baa6ac7..4c7c881 100644
--- a/libavdevice/alsa-audio-common.c
+++ b/libavdevice/alsa-audio-common.c
@@ -146,6 +146,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",



More information about the ffmpeg-cvslog mailing list