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:28:52 (GMT)
commit04c15e14898db69477d4c4a42e8307e62de5b3ac (patch)
treec6c61fd101a61538f321a7c5363da7ac9793e6e5
parent44b6ab20ba8becda944034d78a7eed375c0f385c (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/audio/audiooutputalsa.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/mythtv/libs/libmyth/audio/audiooutputalsa.cpp b/mythtv/libs/libmyth/audio/audiooutputalsa.cpp
index f1eb2eb..0397382 100644
--- a/mythtv/libs/libmyth/audio/audiooutputalsa.cpp
+++ b/mythtv/libs/libmyth/audio/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));