diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-02-04 10:19:51 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-02-04 11:12:13 +0100 |
commit | a79c4e031406fc7659d31e5b39f655bf165d7d0c (patch) | |
tree | 639e19ea2fb4e7abbbd882855340be2afde8ce4b /gst/mxf | |
parent | c4a0bc9887c38d84d04545e84f85f4051e0ff812 (diff) | |
download | gst-plugins-bad-a79c4e031406fc7659d31e5b39f655bf165d7d0c.tar.gz gst-plugins-bad-a79c4e031406fc7659d31e5b39f655bf165d7d0c.tar.bz2 gst-plugins-bad-a79c4e031406fc7659d31e5b39f655bf165d7d0c.zip |
Try to resolve all synchronization issues, not only the first
Diffstat (limited to 'gst/mxf')
-rw-r--r-- | gst/mxf/mxfdemux.c | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 48280072..3d0f280c 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -2485,50 +2485,48 @@ gst_mxf_demux_pull_and_handle_klv_packet (GstMXFDemux * demux) demux->offset += read; if (ret == GST_FLOW_OK && demux->src && demux->essence_tracks) { - guint i; GstMXFDemuxPad *earliest = NULL; - guint64 offset; - 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; + while ((earliest = gst_mxf_demux_get_earliest_pad (demux)) && + demux->segment.last_stop - earliest->last_stop > 500 * GST_MSECOND) { + guint i; + guint64 offset; + gint64 position; - GST_WARNING_OBJECT (demux, - "Found synchronization issue -- trying to solve"); + GST_WARNING_OBJECT (demux, + "Found synchronization issue -- trying to solve"); - position = earliest->current_essence_track_position; + position = earliest->current_essence_track_position; - /* FIXME: This can probably be improved by using the - * offset of position-1 if it's in the same partition - * or the start of the position otherwise. - * This way we won't skip elements from the same essence - * container as etrack->position - */ - offset = - gst_mxf_demux_find_essence_element (demux, - earliest->current_essence_track, &position, FALSE); - if (offset == -1) { - GST_ERROR_OBJECT (demux, "Failed to find offset for late essence track"); - earliest->eos = TRUE; - gst_pad_push_event (GST_PAD_CAST (earliest), gst_event_new_eos ()); - goto beach; - } + /* FIXME: This can probably be improved by using the + * offset of position-1 if it's in the same partition + * or the start of the position otherwise. + * This way we won't skip elements from the same essence + * container as etrack->position + */ + offset = + gst_mxf_demux_find_essence_element (demux, + earliest->current_essence_track, &position, FALSE); + if (offset == -1) { + GST_ERROR_OBJECT (demux, + "Failed to find offset for late essence track"); + earliest->eos = TRUE; + gst_pad_push_event (GST_PAD_CAST (earliest), gst_event_new_eos ()); + continue; + } - demux->offset = offset + demux->run_in; - gst_mxf_demux_set_partition_for_offset (demux, demux->offset); + demux->offset = offset + demux->run_in; + gst_mxf_demux_set_partition_for_offset (demux, demux->offset); - for (i = 0; i < demux->essence_tracks->len; i++) { - GstMXFDemuxEssenceTrack *etrack = - &g_array_index (demux->essence_tracks, GstMXFDemuxEssenceTrack, i); + for (i = 0; i < demux->essence_tracks->len; i++) { + GstMXFDemuxEssenceTrack *etrack = + &g_array_index (demux->essence_tracks, GstMXFDemuxEssenceTrack, i); - etrack->position = -1; + etrack->position = -1; + } + earliest->current_essence_track->position = position; + break; } - earliest->current_essence_track->position = position; } beach: |