Skip to content
  • Vincent Penquerc'h's avatar
    decodebin: fix deadlock between downward state change and pad addition · a2ee84fa
    Vincent Penquerc'h authored
    If caps on a newly added pad are NULL, analyze_new_pad will try to
    acquire the chain lock to add a probe to the pad so the chain can
    be built later. This comes from the streaming thread, in response
    to headers or other buffers causing this pad to be added, so the
    stream lock is taken.
    
    Meanwhile, another thread might be destroying the chain from a
    downward state change. This will cause the chain to be freed with
    the chain lock taken, and some elements are set to NULL here, which
    can include the parser. This causes pad deactivation, which tries
    to take the element's pad's stream lock, deadlocking.
    
    Fix this by keeping track of which elements need setting to NULL,
    and only do this after the chain lock is released. Only the chain
    manipulation needs to be locked, not the elements' state changes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741355
    a2ee84fa