summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2021-07-27 07:59:52 +0200
committerEdward Hervey <bilboed@bilboed.com>2021-07-27 08:55:22 +0200
commit14d123528886027378fc9e9a05fb832cb3667277 (patch)
treec05d86366f116bece2c66cd0db815096b0a152fb /gst
parentb62e942718bfcee50af34485bad01c72ee6fa70e (diff)
downloadgstreamer-plugins-bad-14d123528886027378fc9e9a05fb832cb3667277.tar.gz
mxfdemux: Handle EOS with non-frame wrapping
When reaching the end of non-frame wrapping track in pull mode, we want to force the switch to the next non-eos pad. This is similar to when we exceed the maximum drift. Fixes issues on EOS where not everything would be drained out and stray errors would pop out. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2434>
Diffstat (limited to 'gst')
-rw-r--r--gst/mxf/mxfdemux.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c
index def65c8a7..1b2c4bc6b 100644
--- a/gst/mxf/mxfdemux.c
+++ b/gst/mxf/mxfdemux.c
@@ -4027,6 +4027,7 @@ gst_mxf_demux_pull_and_handle_klv_packet (GstMXFDemux * demux)
{
GstMXFKLV klv;
GstFlowReturn ret = GST_FLOW_OK;
+ gboolean force_switch = FALSE;
if (demux->src->len > 0) {
if (!gst_mxf_demux_get_earliest_pad (demux)) {
@@ -4045,6 +4046,15 @@ gst_mxf_demux_pull_and_handle_klv_packet (GstMXFDemux * demux)
gst_mxf_demux_handle_generic_container_essence_element (demux,
&demux->current_partition->clip_klv, FALSE);
gst_mxf_demux_consume_klv (demux, &demux->current_partition->clip_klv);
+ if (ret == GST_FLOW_OK
+ && demux->current_partition->single_track->position >=
+ demux->current_partition->single_track->duration) {
+ /* We are done with the contents of this clip/custom wrapping, force the
+ * switch to the next non-EOS track */
+ GST_DEBUG_OBJECT (demux, "Single track EOS, switch");
+ force_switch = TRUE;
+ }
+
} else {
ret = gst_mxf_demux_peek_klv_packet (demux, demux->offset, &klv);
@@ -4230,8 +4240,9 @@ gst_mxf_demux_pull_and_handle_klv_packet (GstMXFDemux * demux)
&& demux->essence_tracks->len > 0) {
GstMXFDemuxPad *earliest = NULL;
/* We allow time drifts of at most 500ms */
- while ((earliest = gst_mxf_demux_get_earliest_pad (demux)) &&
- demux->segment.position - earliest->position > demux->max_drift) {
+ while ((earliest = gst_mxf_demux_get_earliest_pad (demux)) && (force_switch
+ || demux->segment.position - earliest->position >
+ demux->max_drift)) {
guint64 offset;
gint64 position;