mxfdemux: Don't double-increase track position
authorEdward Hervey <edward@centricular.com>
Mon, 11 Apr 2022 08:31:15 +0000 (10:31 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 12 Apr 2022 07:57:37 +0000 (07:57 +0000)
The essence track position should only be overriden if we sucesfully switched to
another position. In case of EOS we do not want to override it else we would
increase the track position *again* at the end of this function

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2150>

subprojects/gst-plugins-bad/gst/mxf/mxfdemux.c

index 1b2c4bc..31dc361 100644 (file)
@@ -3109,11 +3109,11 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux,
         ret =
             gst_mxf_demux_pad_set_component (demux, pad,
             pad->current_component_index + 1);
-        if (ret != GST_FLOW_OK && ret != GST_FLOW_EOS) {
-          GST_ERROR_OBJECT (demux, "Switching component failed");
-        } else {
+        if (ret == GST_FLOW_OK) {
           pad->current_essence_track->position =
               pad->current_essence_track_position;
+        } else if (ret != GST_FLOW_EOS) {
+          GST_ERROR_OBJECT (demux, "Switching component failed");
         }
       } else if (etrack->duration > 0
           && pad->current_essence_track_position >= etrack->duration) {