GNOME Bugzilla – Bug 735042
videoaggregator: race of vagg->info on pad removal
Last modified: 2014-10-03 11:19:05 UTC
gst_videoaggregator_release_pad() calls update_converters() with the videoaggregator lock but update_src_caps without that lock. In that time, the aggregate() function (from aggregator) could be called. How it may manifest is with the following critical and backtrace: GStreamer-CRITICAL **: _gst_util_uint64_scale: assertion 'denom != 0' failed (gdb) bt
+ Trace 233972
update_converters() does not deal with the framerate and if the aggregate function is called in between update_converters() and update_src_caps(), there could be a 0/1 framerate in vagg->info which fails with the above backtrace.
Created attachment 283868 [details] test application that shows the issue Based off test from bug #734830
Created attachment 286516 [details] [review] Possible patch, WIP I understand the theorical race but can't reproduce here with you test application. We might want to apply something like what I attach here, but I would need to think better about that and do more testing.
Isn't this now setting the caps on the srcpad while holding the lock? That could lead to deadlocks
Created attachment 287659 [details] [review] aggregator: Take lock to ensure set_caps is not called concurently Avoiding to be in an inconsistent state where we do not have actual negotiate caps set as srccaps and leading to point where we try to unref ->srccaps when they have already been set to NULL.
Created attachment 287660 [details] [review] videoaggregator: Do not to release VIDEO_AGGREGATOR_LOCK while setting format info We should be able to always keep the VIDEO_AGGREGATOR_LOCK while negotiating caps, this patch introduce that change. That also implies that we do not need the SETCAPS_LOCK anymore because now VIDEO_AGGREGATOR_LOCK guarantees that setcaps is not called from several threads and the gst_aggregator_set_caps method is now protected.
Attachment 287659 [details] pushed as 1b4547f - aggregator: Take lock to ensure set_caps is not called concurently Attachment 287660 [details] pushed as 3637296 - videoaggregator: Do not to release VIDEO_AGGREGATOR_LOCK while setting format info