From: Matej Knopp Date: Fri, 27 Sep 2013 20:41:28 +0000 (+0200) Subject: audiorate: clip buffer before pushing it X-Git-Tag: 1.19.3~511^2~4978 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f0993a95d84a00b2e97f49ce180bd1996c45cb6;p=platform%2Fupstream%2Fgstreamer.git audiorate: clip buffer before pushing it https://bugzilla.gnome.org/show_bug.cgi?id=708953 --- diff --git a/gst/audiorate/gstaudiorate.c b/gst/audiorate/gstaudiorate.c index 7f64fd1..23999d1 100644 --- a/gst/audiorate/gstaudiorate.c +++ b/gst/audiorate/gstaudiorate.c @@ -557,7 +557,10 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) audiorate->discont = FALSE; } - ret = gst_pad_push (audiorate->srcpad, fill); + fill = gst_audio_buffer_clip (fill, &audiorate->src_segment, rate, bpf); + if (fill) + ret = gst_pad_push (audiorate->srcpad, fill); + if (ret != GST_FLOW_OK) goto beach; audiorate->out += cursamples; @@ -640,11 +643,14 @@ send: GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DISCONT); } - /* set last_stop on segment */ - audiorate->src_segment.position = - GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf); + buf = gst_audio_buffer_clip (buf, &audiorate->src_segment, rate, bpf); + if (buf) { + /* set last_stop on segment */ + audiorate->src_segment.position = + GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf); - ret = gst_pad_push (audiorate->srcpad, buf); + ret = gst_pad_push (audiorate->srcpad, buf); + } buf = NULL; audiorate->next_offset = in_offset_end;