qtdemux: Fix race on pad reconnection
authorAlicia Boya García <ntrrgc@gmail.com>
Thu, 9 Jan 2020 18:43:02 +0000 (18:43 +0000)
committerThibault Saunier <tsaunier@gnome.org>
Thu, 9 Jan 2020 18:43:02 +0000 (18:43 +0000)
commit8dd42666e34d3d90eacfcb7d9f164de821d954ae
tree460766fd6ae8459e4fa9109ba90a7ff6997ff40c
parent8445685a21b7c912595827646ef2900ebc84a100
qtdemux: Fix race on pad reconnection

Elements emitting frames through several srcpads should use a
flow combiner to aggregate the chain returns and therefore only return
GST_FLOW_NOT_LINKED to upstream when all the downstream pads have
received GST_FLOW_NOT_LINKED.

In addition to that, in order to handle pads being relinked downstream,
the flow combiner should be reset in response to RECONFIGURE events.
This ensures that a both srcpads process a chain operation before a
GST_FLOW_NOT_LINKED can be propagated upstream (which would usually stop
the pipeline).

Otherwise, in a configuration with two srcpads, only one linked at a
time, after the relink the element could chain data through the now
unlinked pad and the flow combiner would resolve as GST_FLOW_NOT_LINKED
(stopping the pipeline) just because the now linked pad has not been
chained yet to update the flow combiner.

This patch adds handling of RECONFIGURE events to qtdemux. Also, since
this event handling causes the flow combiner to be used from a thread
other than the qtdemux streaming thread, usages of the flow combiner
has been guarded by the object lock.
gst/isomp4/qtdemux.c