summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gst/asfdemux/asfpacket.c13
-rw-r--r--gst/asfdemux/gstasfdemux.c34
2 files changed, 29 insertions, 18 deletions
diff --git a/gst/asfdemux/asfpacket.c b/gst/asfdemux/asfpacket.c
index 8f6dc232..ecf1e056 100644
--- a/gst/asfdemux/asfpacket.c
+++ b/gst/asfdemux/asfpacket.c
@@ -190,19 +190,6 @@ gst_asf_payload_queue_for_stream (GstASFDemux * demux, AsfPayload * payload,
GST_BUFFER_FLAG_SET (payload->buf, GST_BUFFER_FLAG_DISCONT);
}
- /* remember the first queued timestamp for the segment */
- if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (demux->segment_ts) &&
- GST_CLOCK_TIME_IS_VALID (demux->first_ts))) {
- GST_DEBUG_OBJECT (demux, "segment ts: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (demux->first_ts));
- demux->segment_ts = demux->first_ts;
- /* always note, but only determines segment when streaming */
- if (demux->streaming)
- gst_segment_do_seek (&demux->segment, demux->in_segment.rate,
- GST_FORMAT_TIME, (GstSeekFlags) demux->segment.flags,
- GST_SEEK_TYPE_SET, demux->segment_ts, GST_SEEK_TYPE_NONE, 0, NULL);
- }
-
g_array_append_vals (stream->payloads, payload, 1);
}
diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c
index b64ee409..ec44035f 100644
--- a/gst/asfdemux/gstasfdemux.c
+++ b/gst/asfdemux/gstasfdemux.c
@@ -1314,6 +1314,23 @@ gst_asf_demux_have_mutually_exclusive_active_stream (GstASFDemux * demux,
}
#endif
+static void
+gst_asf_demux_check_segment_ts (GstASFDemux * demux, GstClockTime payload_ts)
+{
+ /* remember the first queued timestamp for the segment */
+ if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (demux->segment_ts) &&
+ GST_CLOCK_TIME_IS_VALID (demux->first_ts))) {
+ GST_DEBUG_OBJECT (demux, "segment ts: %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (demux->first_ts));
+ demux->segment_ts = payload_ts;
+ /* always note, but only determines segment when streaming */
+ if (demux->streaming)
+ gst_segment_do_seek (&demux->segment, demux->in_segment.rate,
+ GST_FORMAT_TIME, (GstSeekFlags) demux->segment.flags,
+ GST_SEEK_TYPE_SET, demux->segment_ts, GST_SEEK_TYPE_NONE, 0, NULL);
+ }
+}
+
static gboolean
gst_asf_demux_check_first_ts (GstASFDemux * demux, gboolean force)
{
@@ -1368,6 +1385,8 @@ gst_asf_demux_check_first_ts (GstASFDemux * demux, gboolean force)
}
}
+ gst_asf_demux_check_segment_ts (demux, 0);
+
return TRUE;
}
@@ -1505,6 +1524,11 @@ gst_asf_demux_find_stream_with_complete_payload (GstASFDemux * demux)
|| !GST_CLOCK_TIME_IS_VALID (payload->ts)); --last_idx) {
payload = &g_array_index (stream->payloads, AsfPayload, last_idx);
}
+
+ /* if this is first payload after seek we might need to update the segment */
+ if (GST_CLOCK_TIME_IS_VALID (payload->ts))
+ gst_asf_demux_check_segment_ts (demux, payload->ts);
+
if (G_UNLIKELY (GST_CLOCK_TIME_IS_VALID (payload->ts) &&
(payload->ts < demux->segment.start))) {
if (G_UNLIKELY ((!demux->accurate) && payload->keyframe)) {
@@ -1558,14 +1582,14 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux, gboolean force)
/* streams are now activated */
}
- /* wait until we had a chance to "lock on" some payload's timestamp */
- if (G_UNLIKELY (demux->need_newsegment
- && !GST_CLOCK_TIME_IS_VALID (demux->segment_ts)))
- return GST_FLOW_OK;
-
while ((stream = gst_asf_demux_find_stream_with_complete_payload (demux))) {
AsfPayload *payload;
+ /* wait until we had a chance to "lock on" some payload's timestamp */
+ if (G_UNLIKELY (demux->need_newsegment
+ && !GST_CLOCK_TIME_IS_VALID (demux->segment_ts)))
+ return GST_FLOW_OK;
+
payload = &g_array_index (stream->payloads, AsfPayload, 0);
/* do we need to send a newsegment event */