summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Yves Avenard <jyavenard@mythtv.org>2010-12-14 11:28:52 (GMT)
committer Jean-Yves Avenard <jyavenard@mythtv.org>2010-12-14 11:29:58 (GMT)
commit14057823c9f43689f3cb8e68afa2912ee68b4390 (patch)
treeb1191f378fd81f54d48a6896dde950538e5645bb
parent588cc6e2b3818d1c9c9af97b233b28914c226ea6 (diff)
Fix ALSA buffer allocation.
Changing the audio buffer size only works when the audio device is closed. So close it before attempting to open it. This only works if myth has write access
-rw-r--r--mythtv/libs/libmyth/audiooutputalsa.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/mythtv/libs/libmyth/audiooutputalsa.cpp b/mythtv/libs/libmyth/audiooutputalsa.cpp
index f1eb2eb..0397382 100644
--- a/mythtv/libs/libmyth/audiooutputalsa.cpp
+++ b/mythtv/libs/libmyth/audiooutputalsa.cpp
@@ -180,6 +180,11 @@ bool AudioOutputALSA::SetPreallocBufferSize(int size)
if (GetPCMInfo(card, device, subdevice) < 0)
return false;
+ // We can not increase the size of the audio buffer while device is opened
+ // so make sure it is closed
+ if (pcm_handle != NULL)
+ CloseDevice();
+
QFile pfile(QString("/proc/asound/card%1/pcm%2p/sub%3/prealloc")
.arg(card).arg(device).arg(subdevice));