summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaik Scholz <scholz.maik@t-online.de>2016-08-31 11:00:37 +0300
committerSebastian Dröge <sebastian@centricular.com>2016-08-31 11:06:51 +0300
commitc5ddadd472521127bdb810fd4ebb5e3e35f10951 (patch)
tree18a5d6f16d0a0b4c3bc204e92f9cecaaa892bf78
parent793ef9e67127bd77175909b32b5eedf1b4d370a1 (diff)
downloadgstreamer-plugins-base-c5ddadd472521127bdb810fd4ebb5e3e35f10951.tar.gz
audioresample: Don't produce more data than expected in GAP mode
Due to rounding errors in combination with rate changes, we might otherwise end up producing too much and run into an assertion later. This is not a problem with the new audioresample in GIT master. https://bugzilla.gnome.org/show_bug.cgi?id=768836
-rw-r--r--gst/audioresample/gstaudioresample.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gst/audioresample/gstaudioresample.c b/gst/audioresample/gstaudioresample.c
index 7155c3c3a..5c9ea224c 100644
--- a/gst/audioresample/gstaudioresample.c
+++ b/gst/audioresample/gstaudioresample.c
@@ -1056,6 +1056,11 @@ gst_audio_resample_process (GstAudioResample * resample, GstBuffer * inbuf,
else
out_processed = 0;
+ /* take care that out_processed is not greater then out_len */
+ if (out_processed > out_len) {
+ out_processed = out_len;
+ }
+
memset (out_map.data, 0, out_map.size);
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
resample->num_gap_samples += in_len;