aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/oss_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/output/oss_plugin.c')
-rw-r--r--src/output/oss_plugin.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/output/oss_plugin.c b/src/output/oss_plugin.c
index 007d5bc84..eca6f9101 100644
--- a/src/output/oss_plugin.c
+++ b/src/output/oss_plugin.c
@@ -553,7 +553,7 @@ static void oss_dropBufferedAudio(void *data)
}
}
-static bool
+static size_t
oss_playAudio(void *data, const char *playChunk, size_t size)
{
OssData *od = data;
@@ -563,20 +563,17 @@ oss_playAudio(void *data, const char *playChunk, size_t size)
if (od->fd < 0 && !oss_open(od))
return false;
- while (size > 0) {
+ while (true) {
ret = write(od->fd, playChunk, size);
- if (ret < 0) {
- if (errno == EINTR)
- continue;
+ if (ret > 0)
+ return (size_t)ret;
+
+ if (ret < 0 && errno != EINTR) {
g_warning("closing oss device \"%s\" due to write error: "
"%s\n", od->device, strerror(errno));
- return false;
+ return 0;
}
- playChunk += ret;
- size -= ret;
}
-
- return true;
}
const struct audio_output_plugin ossPlugin = {