aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--NEWS1
-rw-r--r--src/pcm_buffer.c5
-rw-r--r--src/pcm_buffer.h4
3 files changed, 10 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index c8f2773bb..3202bc05e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
ver 0.16.8 (2012/??/??)
+* fix for libsamplerate assertion failure
ver 0.16.7 (2012/02/04)
diff --git a/src/pcm_buffer.c b/src/pcm_buffer.c
index b0449d44e..60a699b20 100644
--- a/src/pcm_buffer.c
+++ b/src/pcm_buffer.c
@@ -34,6 +34,11 @@ pcm_buffer_get(struct pcm_buffer *buffer, size_t size)
{
assert(buffer != NULL);
+ if (size == 0)
+ /* never return NULL, because NULL would be assumed to
+ be an error condition */
+ size = 1;
+
if (buffer->size < size) {
/* free the old buffer */
g_free(buffer->buffer);
diff --git a/src/pcm_buffer.h b/src/pcm_buffer.h
index fe223c742..b132d4fd2 100644
--- a/src/pcm_buffer.h
+++ b/src/pcm_buffer.h
@@ -63,6 +63,10 @@ pcm_buffer_deinit(struct pcm_buffer *buffer)
/**
* Get the buffer, and guarantee a minimum size. This buffer becomes
* invalid with the next pcm_buffer_get() call.
+ *
+ * This function will never return NULL, even if size is zero, because
+ * the PCM library uses the NULL return value to signal "error". An
+ * empty destination buffer is not always an error.
*/
G_GNUC_MALLOC
void *