downloadbuffer: Check for flush after seek
authorAlicia Boya García <ntrrgc@gmail.com>
Mon, 22 Jul 2019 15:06:20 +0000 (15:06 +0000)
committerSebastian Dröge <slomo@coaxion.net>
Mon, 22 Jul 2019 15:06:20 +0000 (15:06 +0000)
commitb50abd9f4ebe0ed1981578ae3e55ae2cbe6f57fb
tree596e876922e4f1146d45d6c1ca03421dbcecde58
parent86b9f78788cd8e55e289cf01c05eeac1b00e8da8
downloadbuffer: Check for flush after seek

In gst_download_buffer_wait_for_data(), when a seek is made with
perform_seek_to_offset() the `qlock` is released temporarily. Therefore,
the flushing condition can be set during this period and should be
checked.

This was not being checked before, causing occasional deadlocks when
GST_DOWNLOAD_BUFFER_WAIT_ADD_CHECK() was called.

GST_DOWNLOAD_BUFFER_WAIT_ADD_CHECK() assumes that the caller has already
checked that we're not flushing before, since this is done when
acquiring the lock; so if we release it temporarily somewhere, we need
to check for flush again.

Without that check, the function would keep waiting for the condition
variable to be notified before checking for flushing condition again,
and that may very well never happen. This was reproduced when during pad
deactivation when running WebKit in gdb.
plugins/elements/gstdownloadbuffer.c