mxfdemux: Fix issue with re-syncing

In case of re-syncing (i.e. moving to another partition to avoid too much of an
interleave), there was previously no checks to figure out whether a given
partition was already fully handled (i.e. when coming across it again after a
previous resync).

In order to handle this at least for single-track partitions, check whether we
have reached the essence track duration, and if so skip the partition.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2162>
This commit is contained in:
Edward Hervey 2022-04-11 10:32:40 +02:00 committed by Tim-Philipp Müller
parent 98afe3bacd
commit e882282ffb

View file

@ -4136,6 +4136,7 @@ gst_mxf_demux_pull_and_handle_klv_packet (GstMXFDemux * demux)
/* We entered a new partition */
if (ret == GST_FLOW_OK && mxf_is_partition_pack (&klv.key)) {
GstMXFDemuxPartition *partition = demux->current_partition;
gboolean partition_done = FALSE;
/* Grab footer metadata if needed */
if (demux->pull_footer_metadata
@ -4178,8 +4179,13 @@ gst_mxf_demux_pull_and_handle_klv_packet (GstMXFDemux * demux)
"Track already at another position : %" G_GINT64_FORMAT,
partition->single_track->position);
if (find_edit_entry (demux, partition->single_track,
partition->single_track->position, FALSE, &entry))
partition->single_track->position, FALSE, &entry)) {
lowest_offset = entry.offset;
} else if (partition->single_track->position >=
partition->single_track->duration) {
GST_DEBUG_OBJECT (demux, "Track fully consumed, partition done");
partition_done = TRUE;
}
}
} else {
guint i;
@ -4207,14 +4213,15 @@ gst_mxf_demux_pull_and_handle_klv_packet (GstMXFDemux * demux)
}
}
if (lowest_offset != G_MAXUINT64) {
if (partition_done || lowest_offset != G_MAXUINT64) {
GstMXFDemuxPartition *next_partition = NULL;
GList *cur_part = g_list_find (demux->partitions, partition);
if (cur_part && cur_part->next)
next_partition = (GstMXFDemuxPartition *) cur_part->next->data;
/* If we have completely processed this partition, skip to next partition */
if (lowest_offset > next_partition->partition.this_partition) {
if (partition_done
|| lowest_offset > next_partition->partition.this_partition) {
GST_DEBUG_OBJECT (demux,
"Partition entirely processed, skipping to next one");
demux->offset = next_partition->partition.this_partition;