audiorate: clip buffer before pushing it

https://bugzilla.gnome.org/show_bug.cgi?id=708953
This commit is contained in:
Matej Knopp 2013-09-27 22:41:28 +02:00 committed by Sebastian Dröge
parent dbaf1bf0a3
commit 2f0993a95d

View file

@ -557,7 +557,10 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
audiorate->discont = FALSE; 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) if (ret != GST_FLOW_OK)
goto beach; goto beach;
audiorate->out += cursamples; audiorate->out += cursamples;
@ -640,11 +643,14 @@ send:
GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DISCONT); GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DISCONT);
} }
/* set last_stop on segment */ buf = gst_audio_buffer_clip (buf, &audiorate->src_segment, rate, bpf);
audiorate->src_segment.position = if (buf) {
GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (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; buf = NULL;
audiorate->next_offset = in_offset_end; audiorate->next_offset = in_offset_end;