From eff64c7ddccf73857dba7a5cad72cd846f6d6d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 18 Dec 2014 22:42:14 +0100 Subject: [PATCH] audiomixer: The pad's size is always supposed to be the whole buffer size And the offset the offset into that buffer. Changing the size will cause all kinds of assumptions to fail and cause crashes. --- gst/audiomixer/gstaudiomixer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gst/audiomixer/gstaudiomixer.c b/gst/audiomixer/gstaudiomixer.c index 3559750343..e219132cbc 100644 --- a/gst/audiomixer/gstaudiomixer.c +++ b/gst/audiomixer/gstaudiomixer.c @@ -1114,10 +1114,9 @@ gst_audio_mixer_fill_buffer (GstAudioMixer * audiomixer, GstAudioMixerPad * pad, if (start_running_time_offset < audiomixer->offset) { GstBuffer *buf; guint diff = (audiomixer->offset - start_running_time_offset) * bpf; + pad->position += diff; - pad->size -= diff; - /* FIXME: This could only happen due to rounding errors */ - if (pad->size == 0) { + if (pad->position >= pad->size) { /* Empty buffer, drop */ gst_buffer_unref (inbuf); pad->buffer = NULL;