summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Yves Avenard <jyavenard@mythtv.org>2010-12-15 13:42:48 (GMT)
committer Jean-Yves Avenard <jyavenard@mythtv.org>2010-12-15 13:42:48 (GMT)
commit01752011c6ec078ba911340c82d4ec104f19129f (patch)
treec5b11a05e73ca494c6dee945dbd664ba6981ad68
parent4bc2262da2d3d720ddc1be6aada4fdc6c66465d4 (diff)
Try to increase ALSA bugger by 64kB block
-rw-r--r--mythtv/libs/libmyth/audio/audiooutputalsa.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/mythtv/libs/libmyth/audio/audiooutputalsa.cpp b/mythtv/libs/libmyth/audio/audiooutputalsa.cpp
index 6eead60..5180647 100644
--- a/mythtv/libs/libmyth/audio/audiooutputalsa.cpp
+++ b/mythtv/libs/libmyth/audio/audiooutputalsa.cpp
@@ -242,21 +242,26 @@ bool AudioOutputALSA::IncPreallocBufferSize(int buffer_time)
int cur = pfile.readAll().trimmed().toInt();
int max = mfile.readAll().trimmed().toInt();
- int size = (samplerate / 1000) *
- (buffer_time / 1000) *
- output_bytes_per_frame / 1024;
+ int size = (((samplerate / 1000) *
+ (buffer_time / 1000) *
+ output_bytes_per_frame / 1024) / 64 + 1) * 64;
VBAUDIO(QString("Prealloc buffer cur: %1 need: %2 max: %3")
.arg(cur).arg(size).arg(max));
- if (size > max)
+ if(size == cur)
{
- size = max;
+ pfile.close();
+ mfile.close();
ret = false;
+ return ret;
}
-
- if (!size)
+
+ if (size > max || !size)
+ {
+ size = max;
ret = false;
+ }
pfile.close();
mfile.close();