aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/osx_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-12-24 17:54:41 +0100
committerMax Kellermann <max@duempel.org>2011-12-24 17:59:36 +0100
commit97b4a6b51f146b16eeac9334605f8a6fff1c0af7 (patch)
tree67286a9150c11d9f377df273d13a9ad1ed17100b /src/output/osx_plugin.c
parentf405d27c56610b4cd466cf3cf81d4079924168dd (diff)
downloadmpd-97b4a6b51f146b16eeac9334605f8a6fff1c0af7.tar.gz
mpd-97b4a6b51f146b16eeac9334605f8a6fff1c0af7.tar.xz
mpd-97b4a6b51f146b16eeac9334605f8a6fff1c0af7.zip
output/osx: clear render buffer when there's not enough data
When we don't have enough data, generate some silence, hoping the input buffer will fill soon. Reducing the render buffer size is not legal.
Diffstat (limited to '')
-rw-r--r--src/output/osx_plugin.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/output/osx_plugin.c b/src/output/osx_plugin.c
index d7abae096..5284afc29 100644
--- a/src/output/osx_plugin.c
+++ b/src/output/osx_plugin.c
@@ -118,7 +118,6 @@ osx_render(void *vdata,
g_mutex_lock(od->mutex);
bytes_to_copy = MIN(od->len, buffer_size);
- buffer_size = bytes_to_copy;
od->len -= bytes_to_copy;
trailer_length = od->buffer_size - od->pos;
@@ -140,7 +139,9 @@ osx_render(void *vdata,
g_cond_signal(od->condition);
g_mutex_unlock(od->mutex);
- buffer->mDataByteSize = buffer_size;
+ if (bytes_to_copy < buffer_size)
+ memset((unsigned char*)buffer->mData + bytes_to_copy, 0,
+ buffer_size - bytes_to_copy);
return 0;
}