mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 13:02:35 +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,6 +418,9 @@ void AlsaOut::WriteLoop() {
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
LOCK("WRITE_BUFFER()");
|
||||
if (this->pcmHandle) {
|
||||
WRITE_BUFFER(this->pcmHandle, next, samplesPerChannel); /* sets 'err' */
|
||||
|
||||
if (err == -EINTR || err == -EPIPE || err == -ESTRPIPE) {
|
||||
@ -425,6 +429,8 @@ void AlsaOut::WriteLoop() {
|
||||
WRITE_BUFFER(this->pcmHandle, next, samplesPerChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (err > 0 && err < (int) samplesPerChannel) {
|
||||
std::cerr << "AlsaOut: short write. expected=" << samplesPerChannel << ", actual=" << err << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user