From: Tim-Philipp Müller Date: Thu, 13 Jan 2022 11:31:55 +0000 (+0000) Subject: mxfdemux: don't error out if VANC track only contains packets we don't handle X-Git-Tag: 1.20.0~119 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cab0eaed1cb9bbb2204c6d02f1b33d9bec53187f;p=platform%2Fupstream%2Fgstreamer.git mxfdemux: don't error out if VANC track only contains packets we don't handle If the VANC track does contain packets, but we skip over all packets, just treat it the same as if there hadn't been any packets at all and send a GAP event instead of erroring out with "Failed to handle essence element". We would error out because when we reach the end of the loop without having found a closed caption packet the flow return variable is still FLOW_ERROR which is what it has been initialised to. Part-of: --- diff --git a/subprojects/gst-plugins-bad/gst/mxf/mxfvanc.c b/subprojects/gst-plugins-bad/gst/mxf/mxfvanc.c index f934246..d2530e0 100644 --- a/subprojects/gst-plugins-bad/gst/mxf/mxfvanc.c +++ b/subprojects/gst-plugins-bad/gst/mxf/mxfvanc.c @@ -138,12 +138,9 @@ mxf_vanc_handle_essence_element (const MXFUL * key, GstBuffer * buffer, * * The same scheme can be used for ANC packets. */ - - *outbuf = gst_buffer_new (); - GST_BUFFER_FLAG_SET (*outbuf, GST_BUFFER_FLAG_GAP); - ret = GST_FLOW_OK; - goto out; + goto no_data; } + for (i = 0; i < num_packets; i++) { G_GNUC_UNUSED guint16 line_num; G_GNUC_UNUSED guint8 wrapping_type; @@ -190,6 +187,7 @@ mxf_vanc_handle_essence_element (const MXFUL * key, GstBuffer * buffer, /* Not S334 EIA-708 */ if (did != 0x61 && sdid != 0x01) { + GST_TRACE ("Skipping VANC data with DID/SDID 0x%02X/0x%02X", did, sdid); if (!gst_byte_reader_skip (&reader, array_count * array_item_size - 2)) goto out; continue; @@ -215,6 +213,14 @@ mxf_vanc_handle_essence_element (const MXFUL * key, GstBuffer * buffer, gst_buffer_unref (buffer); return GST_FLOW_OK; } + +no_data: + + /* No packets or we skipped over all packets */ + *outbuf = gst_buffer_new (); + GST_BUFFER_FLAG_SET (*outbuf, GST_BUFFER_FLAG_GAP); + ret = GST_FLOW_OK; + out: gst_buffer_unmap (buffer, &map); gst_buffer_unref (buffer);