Browse files

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
  • Loading branch information...
1 parent 588cc6e commit 14057823c9f43689f3cb8e68afa2912ee68b4390 @jyavenard jyavenard committed Dec 14, 2010
Showing with 5 additions and 0 deletions.
  1. +5 −0 mythtv/libs/libmyth/audiooutputalsa.cpp
View
5 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));

0 comments on commit 1405782

Please sign in to comment.