mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
asfdemux: Delay newsegment handling until we have a keyframe.
We now have a chance for packets to be collected before we send out the newsegment. If we're not in accurate seeking (keyunit) it will set the segment start/time to the keyframe's timestamp.
This commit is contained in:
parent
3b63c95450
commit
d451dff520
1 changed files with 50 additions and 41 deletions
|
@ -1219,17 +1219,22 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux, gboolean force)
|
|||
/* streams are now activated */
|
||||
}
|
||||
|
||||
/* do we need to send a newsegment event */
|
||||
if (demux->need_newsegment) {
|
||||
|
||||
/* wait until we had a chance to "lock on" some payload's timestamp */
|
||||
if (!GST_CLOCK_TIME_IS_VALID (demux->segment_ts))
|
||||
if (G_UNLIKELY (demux->need_newsegment
|
||||
&& !GST_CLOCK_TIME_IS_VALID (demux->segment_ts)))
|
||||
return GST_FLOW_OK;
|
||||
else {
|
||||
|
||||
while ((stream = gst_asf_demux_find_stream_with_complete_payload (demux))) {
|
||||
AsfPayload *payload;
|
||||
|
||||
payload = &g_array_index (stream->payloads, AsfPayload, 0);
|
||||
|
||||
/* do we need to send a newsegment event */
|
||||
if ((G_UNLIKELY (demux->need_newsegment))) {
|
||||
|
||||
/* safe default if insufficient upstream info */
|
||||
if (!GST_CLOCK_TIME_IS_VALID (demux->in_gap))
|
||||
demux->in_gap = 0;
|
||||
}
|
||||
|
||||
if (demux->segment.stop == GST_CLOCK_TIME_NONE &&
|
||||
demux->segment.duration > 0) {
|
||||
|
@ -1237,6 +1242,15 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux, gboolean force)
|
|||
demux->segment.stop = demux->segment.duration + demux->in_gap;
|
||||
}
|
||||
|
||||
/* FIXME : only if ACCURATE ! */
|
||||
if (G_LIKELY (!demux->accurate
|
||||
&& (GST_CLOCK_TIME_IS_VALID (payload->ts)))) {
|
||||
GST_DEBUG ("Adjusting newsegment start to %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (payload->ts));
|
||||
demux->segment.start = payload->ts;
|
||||
demux->segment.time = payload->ts;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (demux, "sending new-segment event %" GST_SEGMENT_FORMAT,
|
||||
&demux->segment);
|
||||
|
||||
|
@ -1261,11 +1275,6 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux, gboolean force)
|
|||
demux->segment_running = TRUE;
|
||||
}
|
||||
|
||||
while ((stream = gst_asf_demux_find_stream_with_complete_payload (demux))) {
|
||||
AsfPayload *payload;
|
||||
|
||||
payload = &g_array_index (stream->payloads, AsfPayload, 0);
|
||||
|
||||
/* Do we have tags pending for this stream? */
|
||||
if (stream->pending_tags) {
|
||||
GST_LOG_OBJECT (stream->pad, "%" GST_PTR_FORMAT, stream->pending_tags);
|
||||
|
|
Loading…
Reference in a new issue