summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Yves Avenard <jyavenard@mythtv.org>2010-12-10 12:41:21 (GMT)
committer Jean-Yves Avenard <jyavenard@mythtv.org>2010-12-13 11:42:52 (GMT)
commit0d719aa54df4e04fa6ffbfe2f6bfd2a7a60c7c00 (patch)
tree424a4759c6c72fad65a5ce08990be8e6ae41671d
parent8115c4470f48595932035ee6dfac161ffffb86af (diff)
Following SHA: 9dc22bcc223e753d072dcdb2910ea271d377a5ef. Add a little bit of leeway when checking the alsa buffer size, as alsa may round down the value.
-rw-r--r--mythtv/libs/libmyth/audiooutputalsa.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/mythtv/libs/libmyth/audiooutputalsa.cpp b/mythtv/libs/libmyth/audiooutputalsa.cpp
index 1960c8c..73ed0a8 100644
--- a/mythtv/libs/libmyth/audiooutputalsa.cpp
+++ b/mythtv/libs/libmyth/audiooutputalsa.cpp
@@ -656,7 +656,8 @@ int AudioOutputALSA::SetParameters(snd_pcm_t *handle, snd_pcm_format_t format,
// See if we need to increase the prealloc'd buffer size
// If buffer_time is too small we could underrun
- if (buffer_time < original_buffer_time && pbufsize < 0)
+ // Make 10% leeway okay
+ if (buffer_time * 1.10f < (float)original_buffer_time && pbufsize < 0)
{
VBAUDIO(QString("Requested %1us got %2 buffer time")
.arg(original_buffer_time).arg(buffer_time));
@@ -666,6 +667,7 @@ int AudioOutputALSA::SetParameters(snd_pcm_t *handle, snd_pcm_format_t format,
VBAUDIO(QString("Buffer time = %1 us").arg(buffer_time));
/* set the period time */
+ dir = 1;
err = snd_pcm_hw_params_set_period_time_near(handle, params,
&period_time, &dir);
CHECKERR(QString("Unable to set period time %1").arg(period_time));
@@ -682,7 +684,7 @@ int AudioOutputALSA::SetParameters(snd_pcm_t *handle, snd_pcm_format_t format,
/* set member variables */
soundcard_buffer_size = buffer_size * output_bytes_per_frame;
- fragment_size = (period_size * output_bytes_per_frame) >> 1;
+ fragment_size = (period_size * output_bytes_per_frame);
/* get the current swparams */
err = snd_pcm_sw_params_current(handle, swparams);