Permalink
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 44b6ab2 commit 04c15e14898db69477d4c4a42e8307e62de5b3ac @jyavenard jyavenard committed Dec 14, 2010
Showing with 5 additions and 0 deletions.
  1. +5 −0 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));

0 comments on commit 04c15e1

Please sign in to comment.