diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-06-22 15:33:56 -0400 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2011-11-05 13:18:32 +0100 |
commit | 81d5ceff04985c71a5bc84f7c88a6487c0afaf61 (patch) | |
tree | 4d10b9e9d7ce4dc79d7c584e006f93a3281bf080 /libavdevice/alsa-audio-common.c | |
parent | 86849f097696cf5f54ab9ddf2ec170ad0cdf9b93 (diff) | |
download | ffmpeg-81d5ceff04985c71a5bc84f7c88a6487c0afaf61.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.
(cherry picked from commit 8bfd7f6a475225a0595bf657f8b99a8fffb461e4)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Diffstat (limited to 'libavdevice/alsa-audio-common.c')
-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 38cb0de0ef..12195de93e 100644 --- a/libavdevice/alsa-audio-common.c +++ b/libavdevice/alsa-audio-common.c @@ -129,6 +129,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", |