libs/gst/base/gstbasetransform.c: Properly set the last_stop position on GstSegment. This will only happen if there i...

Original commit message from CVS:
* libs/gst/base/gstbasetransform.c: (gst_base_transform_chain):
Properly set the last_stop position on GstSegment. This will only happen
if there is a buffer to push out.
This commit is contained in:
Edward Hervey 2007-05-03 16:44:34 +00:00
parent 1d16f949be
commit c086db87a3
2 changed files with 20 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2007-05-03 Edward Hervey <edward@fluendo.com>
* libs/gst/base/gstbasetransform.c: (gst_base_transform_chain):
Properly set the last_stop position on GstSegment. This will only happen
if there is a buffer to push out.
2007-05-03 Wim Taymans <wim@fluendo.com>
* libs/gst/base/gstbasetransform.c:

View file

@ -1566,10 +1566,19 @@ gst_base_transform_chain (GstPad * pad, GstBuffer * buffer)
{
GstBaseTransform *trans;
GstFlowReturn ret;
GstClockTime last_stop = GST_CLOCK_TIME_NONE;
GstBuffer *outbuf = NULL;
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
/* calculate end position of the incoming buffer */
if (GST_BUFFER_TIMESTAMP (buffer) != GST_CLOCK_TIME_NONE) {
if (GST_BUFFER_DURATION (buffer) != GST_CLOCK_TIME_NONE)
last_stop = GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer);
else
last_stop = GST_BUFFER_TIMESTAMP (buffer);
}
/* protect transform method and concurrent buffer alloc */
g_mutex_lock (trans->transform_lock);
ret = gst_base_transform_handle_buffer (trans, buffer, &outbuf);
@ -1579,6 +1588,11 @@ gst_base_transform_chain (GstPad * pad, GstBuffer * buffer)
* GST_BASE_TRANSFORM_FLOW_DROPPED we will not push either. */
if (outbuf != NULL) {
if ((ret == GST_FLOW_OK)) {
/* Remember last stop position */
if ((last_stop != GST_CLOCK_TIME_NONE) &&
(trans->segment.format == GST_FORMAT_TIME))
gst_segment_set_last_stop (&trans->segment, GST_FORMAT_TIME, last_stop);
/* apply DISCONT flag if the buffer is not yet marked as such */
if (trans->priv->discont) {
if (!GST_BUFFER_IS_DISCONT (outbuf)) {