Browse Source

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 8bfd7f6a47)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
tags/n0.8.4
Justin Ruggles Anton Khirnov 14 years ago
parent
commit
9bf76932e5
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      libavdevice/alsa-audio-common.c

+ 2
- 0
libavdevice/alsa-audio-common.c View File

@@ -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",


Loading…
Cancel
Save