Set period and buffer size for the input device (fixes packet read interval).

git-svn-id: http://yate.null.ro/svn/yate/trunk@4088 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2011-02-01 16:53:31 +00:00
parent f6644b2110
commit 64cc3e02e2
1 changed files with 2 additions and 0 deletions

View File

@ -355,6 +355,8 @@ bool AlsaDevice::open()
if ((err = snd_pcm_hw_params_set_format (m_handle_in, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) Debug(DebugWarn, "cannot set sample format (%s)", snd_strerror (err));
if ((err = snd_pcm_hw_params_set_rate_near (m_handle_in, hw_params, &rate_in, &direction)) < 0) Debug(DebugWarn, "cannot set sample rate %u (%s)", m_rate, snd_strerror (err));
if ((err = snd_pcm_hw_params_set_channels (m_handle_in, hw_params, 1)) < 0) Debug(DebugWarn, "cannot set channel count (%s)", snd_strerror (err));
if ((err = snd_pcm_hw_params_set_period_size_near(m_handle_in, hw_params, &period_size_in, &direction)) < 0) Debug(DebugWarn, "cannot set period size (%s)", snd_strerror (err));
if ((err = snd_pcm_hw_params_set_buffer_size_near(m_handle_in, hw_params, &buffer_size_in)) < 0) Debug(DebugWarn, "cannot set buffer size (%s)", snd_strerror (err));
if ((err = snd_pcm_hw_params (m_handle_in, hw_params)) < 0) Debug(DebugWarn, "cannot set parameters (%s)", snd_strerror (err));
snd_pcm_hw_params_free (hw_params);