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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1518>
This commit is contained in:
Tim-Philipp Müller 2022-01-13 11:31:55 +00:00
parent 05ee44b62b
commit cab0eaed1c

View file

@ -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);