Try to resolve all synchronization issues, not only the first

This commit is contained in:
Sebastian Dröge 2009-02-04 10:19:51 +01:00
parent c4a0bc9887
commit a79c4e0314

View file

@ -2485,19 +2485,14 @@ gst_mxf_demux_pull_and_handle_klv_packet (GstMXFDemux * demux)
demux->offset += read; demux->offset += read;
if (ret == GST_FLOW_OK && demux->src && demux->essence_tracks) { if (ret == GST_FLOW_OK && demux->src && demux->essence_tracks) {
guint i;
GstMXFDemuxPad *earliest = NULL; GstMXFDemuxPad *earliest = NULL;
/* We allow time drifts of at most 500ms */
while ((earliest = gst_mxf_demux_get_earliest_pad (demux)) &&
demux->segment.last_stop - earliest->last_stop > 500 * GST_MSECOND) {
guint i;
guint64 offset; guint64 offset;
gint64 position; gint64 position;
earliest = gst_mxf_demux_get_earliest_pad (demux);
if (!earliest)
goto beach;
/* We allow time drifts of at most 500ms */
if (demux->segment.last_stop - earliest->last_stop <= 500 * GST_MSECOND)
goto beach;
GST_WARNING_OBJECT (demux, GST_WARNING_OBJECT (demux,
"Found synchronization issue -- trying to solve"); "Found synchronization issue -- trying to solve");
@ -2513,10 +2508,11 @@ gst_mxf_demux_pull_and_handle_klv_packet (GstMXFDemux * demux)
gst_mxf_demux_find_essence_element (demux, gst_mxf_demux_find_essence_element (demux,
earliest->current_essence_track, &position, FALSE); earliest->current_essence_track, &position, FALSE);
if (offset == -1) { if (offset == -1) {
GST_ERROR_OBJECT (demux, "Failed to find offset for late essence track"); GST_ERROR_OBJECT (demux,
"Failed to find offset for late essence track");
earliest->eos = TRUE; earliest->eos = TRUE;
gst_pad_push_event (GST_PAD_CAST (earliest), gst_event_new_eos ()); gst_pad_push_event (GST_PAD_CAST (earliest), gst_event_new_eos ());
goto beach; continue;
} }
demux->offset = offset + demux->run_in; demux->offset = offset + demux->run_in;
@ -2529,6 +2525,8 @@ gst_mxf_demux_pull_and_handle_klv_packet (GstMXFDemux * demux)
etrack->position = -1; etrack->position = -1;
} }
earliest->current_essence_track->position = position; earliest->current_essence_track->position = position;
break;
}
} }
beach: beach: