GST_DEBUG_OBJECT (demux, "first ts: %" GST_TIME_FORMAT,
GST_TIME_ARGS (payload->ts));
demux->first_ts = payload->ts;
- if (demux->streaming) {
- gst_segment_set_seek (&demux->segment, demux->segment.rate,
- GST_FORMAT_TIME, demux->segment.flags, GST_SEEK_TYPE_SET,
- demux->first_ts, GST_SEEK_TYPE_NONE, 0, NULL);
- }
}
/* make timestamps start from 0 */
- if (!demux->streaming) {
- if (demux->first_ts < payload->ts)
- payload->ts -= demux->first_ts;
- else
- payload->ts = 0;
- }
+ if (demux->first_ts < payload->ts)
+ payload->ts -= demux->first_ts;
+ else
+ payload->ts = 0;
/* remove any incomplete payloads that will never be completed */
while (stream->payloads->len > 0) {
GST_BUFFER_FLAG_SET (payload->buf, GST_BUFFER_FLAG_DISCONT);
}
+ /* remember the first queued timestamp for the segment */
+ if (!GST_CLOCK_TIME_IS_VALID (demux->segment_ts) &&
+ GST_CLOCK_TIME_IS_VALID (payload->ts)) {
+ GST_DEBUG_OBJECT (demux, "segment ts: %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (payload->ts));
+ demux->segment_ts = payload->ts;
+ /* always note, but only determines segment when streaming */
+ if (demux->streaming)
+ gst_segment_set_seek (&demux->segment, demux->segment.rate,
+ GST_FORMAT_TIME, demux->segment.flags, GST_SEEK_TYPE_SET,
+ demux->segment_ts, GST_SEEK_TYPE_NONE, 0, NULL);
+ }
+
g_array_append_vals (stream->payloads, payload, 1);
}
demux->num_streams = 0;
demux->activated_streams = FALSE;
demux->first_ts = GST_CLOCK_TIME_NONE;
+ demux->segment_ts = GST_CLOCK_TIME_NONE;
demux->state = GST_ASF_DEMUX_STATE_HEADER;
demux->seekable = FALSE;
demux->broadcast = FALSE;
/* in either case, clear some state and generate newsegment later on */
GST_OBJECT_LOCK (demux);
- demux->first_ts = GST_CLOCK_TIME_NONE;
+ demux->segment_ts = GST_CLOCK_TIME_NONE;
demux->need_newsegment = TRUE;
gst_asf_demux_reset_stream_state_after_discont (demux);
GST_OBJECT_UNLOCK (demux);
if (demux->need_newsegment) {
/* wait until we had a chance to "lock on" some payload's timestamp */
- if (!GST_CLOCK_TIME_IS_VALID (demux->first_ts))
+ if (!GST_CLOCK_TIME_IS_VALID (demux->segment_ts))
return GST_FLOW_OK;
if (demux->segment.stop == GST_CLOCK_TIME_NONE &&