From e63ad51dabc0404da2a4dd06e4bc1efddc1dbaf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 21 Jan 2015 09:37:30 +0100 Subject: [PATCH] audiosrc: Fill in the correct silence For unsigned raw formats this is not all zeroes, and for non-raw formats we just continue to assume all zeroes for now. https://bugzilla.gnome.org/show_bug.cgi?id=739446 --- gst-libs/gst/audio/gstaudiosrc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/audio/gstaudiosrc.c b/gst-libs/gst/audio/gstaudiosrc.c index 197ab1722e..888fdf2c4a 100644 --- a/gst-libs/gst/audio/gstaudiosrc.c +++ b/gst-libs/gst/audio/gstaudiosrc.c @@ -393,7 +393,14 @@ gst_audio_src_ring_buffer_acquire (GstAudioRingBuffer * buf, goto could_not_open; buf->size = spec->segtotal * spec->segsize; - buf->memory = g_malloc0 (buf->size); + buf->memory = g_malloc (buf->size); + if (buf->spec.type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW) { + gst_audio_format_fill_silence (buf->spec.info.finfo, buf->memory, + buf->size); + } else { + /* FIXME, non-raw formats get 0 as the empty sample */ + memset (buf->memory, 0, buf->size); + } abuf = GST_AUDIO_SRC_RING_BUFFER (buf); abuf->running = TRUE;