aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/oss.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/Alc/oss.c b/Alc/oss.c
index b1ec7887..93df6ae2 100644
--- a/Alc/oss.c
+++ b/Alc/oss.c
@@ -79,35 +79,35 @@ static ALuint OSSProc(ALvoid *ptr)
{
ALCdevice *pDevice = (ALCdevice*)ptr;
oss_data *data = (oss_data*)pDevice->ExtraData;
- int remaining = 0;
int wrote;
while(!data->killNow)
{
- int len = data->data_size - remaining;
+ ALint len = data->data_size;
+ ALubyte *WritePtr = data->mix_data;
- if(len > 0)
- {
- SuspendContext(NULL);
- aluMixData(pDevice->Context, data->mix_data+remaining, len, pDevice->Format);
- ProcessContext(NULL);
- }
+ SuspendContext(NULL);
+ aluMixData(pDevice->Context, WritePtr, len, pDevice->Format);
+ ProcessContext(NULL);
- remaining += len;
- wrote = write(data->fd, data->mix_data, remaining);
- if(wrote < 0)
+ while(len > 0 && !data->killNow)
{
- AL_PRINT("write failed: %s\n", strerror(errno));
- remaining = 0;
+ wrote = write(data->fd, WritePtr, len);
+ if(wrote < 0)
+ {
+ if(errno != EAGAIN && errno != EWOULDBLOCK)
+ {
+ AL_PRINT("write failed: %s\n", strerror(errno));
+ len = 0;
+ }
+ else
+ Sleep(1);
+ continue;
+ }
+
+ len -= wrote;
+ WritePtr += wrote;
}
- else if(wrote > 0)
- {
- remaining -= wrote;
- if(remaining > 0)
- memmove(data->mix_data, data->mix_data+wrote, remaining);
- }
- else
- Sleep(1);
}
return 0;