mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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.
This commit is contained in:
parent
4c98976124
commit
8bfd7f6a47
@ -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);
|
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);
|
res = snd_pcm_hw_params_set_period_size_near(h, hw_params, &period_size, NULL);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
av_log(ctx, AV_LOG_ERROR, "cannot set ALSA period size (%s)\n",
|
av_log(ctx, AV_LOG_ERROR, "cannot set ALSA period size (%s)\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user