basesink; handle EOS correctly.

Handle EOS and buffers without a timestamp gracefully.
Remove a warning that is not so much a warning now anymore.
This commit is contained in:
Wim Taymans 2009-06-03 15:39:13 +02:00
parent db6f3ae042
commit a907f8d145

View file

@ -1520,6 +1520,9 @@ stop_stepping (GstBaseSink * sink, GstSegment * segment,
GST_DEBUG_OBJECT (sink, GST_DEBUG_OBJECT (sink,
"step stop at running_time %" GST_TIME_FORMAT ", timestamp %" "step stop at running_time %" GST_TIME_FORMAT ", timestamp %"
GST_TIME_FORMAT, GST_TIME_ARGS (*rstart), GST_TIME_ARGS (cstart)); GST_TIME_FORMAT, GST_TIME_ARGS (*rstart), GST_TIME_ARGS (cstart));
if (*rstart == -1)
*rstart = current->start + current->position;
current->duration = *rstart - current->start; current->duration = *rstart - current->start;
segment->time = segment->time =
@ -1527,16 +1530,21 @@ stop_stepping (GstBaseSink * sink, GstSegment * segment,
segment->start = cstart; segment->start = cstart;
*rstart = current->start; *rstart = current->start;
*rstop -= current->duration; if (*rstop != -1)
*rstop -= current->duration;
} else { } else {
GST_DEBUG_OBJECT (sink, GST_DEBUG_OBJECT (sink,
"step stop at running_time %" GST_TIME_FORMAT ", timestamp %" "step stop at running_time %" GST_TIME_FORMAT ", timestamp %"
GST_TIME_FORMAT, GST_TIME_ARGS (*rstop), GST_TIME_ARGS (cstop)); GST_TIME_FORMAT, GST_TIME_ARGS (*rstop), GST_TIME_ARGS (cstop));
if (*rstop == -1)
*rstop = current->start + current->position;
current->duration = *rstop - current->start; current->duration = *rstop - current->start;
segment->stop = cstop; segment->stop = cstop;
*rstop = current->start; *rstop = current->start;
*rstart -= current->duration; if (*rstart != -1)
*rstart -= current->duration;
} }
segment->accum = current->start; segment->accum = current->start;
@ -1794,10 +1802,9 @@ eos_done:
/* special cases */ /* special cases */
out_of_segment: out_of_segment:
{ {
/* should not happen since we clip them in the chain function already, /* we usually clip in the chain function already but stepping could cause
* we return FALSE so that we don't try to sync on it. */ * the segment to be updated later. we return FALSE so that we don't try
GST_ELEMENT_WARNING (basesink, STREAM, FAILED, * to sync on it. */
(NULL), ("unexpected buffer out of segment found."));
GST_LOG_OBJECT (basesink, "buffer skipped, not in segment"); GST_LOG_OBJECT (basesink, "buffer skipped, not in segment");
return FALSE; return FALSE;
} }