mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +00:00
Yikes, found a pretty nasty race condition in AlsaOut. This should
stabilize things.
This commit is contained in:
parent
5cbdea7b1e
commit
0e6e96b58f
@ -165,6 +165,7 @@ AlsaOut::~AlsaOut() {
|
||||
}
|
||||
|
||||
void AlsaOut::CloseDevice() {
|
||||
LOCK("CloseDevice()");
|
||||
if (this->pcmHandle) {
|
||||
std::cerr << "AlsaOut: closing PCM handle\n";
|
||||
snd_pcm_close(this->pcmHandle);
|
||||
@ -417,12 +418,17 @@ void AlsaOut::WriteLoop() {
|
||||
}
|
||||
}
|
||||
|
||||
WRITE_BUFFER(this->pcmHandle, next, samplesPerChannel); /* sets 'err' */
|
||||
{
|
||||
LOCK("WRITE_BUFFER()");
|
||||
if (this->pcmHandle) {
|
||||
WRITE_BUFFER(this->pcmHandle, next, samplesPerChannel); /* sets 'err' */
|
||||
|
||||
if (err == -EINTR || err == -EPIPE || err == -ESTRPIPE) {
|
||||
if (!snd_pcm_recover(this->pcmHandle, err, 1)) {
|
||||
/* try one more time... */
|
||||
WRITE_BUFFER(this->pcmHandle, next, samplesPerChannel);
|
||||
if (err == -EINTR || err == -EPIPE || err == -ESTRPIPE) {
|
||||
if (!snd_pcm_recover(this->pcmHandle, err, 1)) {
|
||||
/* try one more time... */
|
||||
WRITE_BUFFER(this->pcmHandle, next, samplesPerChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user