GNOME Bugzilla – Bug 785957
adaptivedemux: leaks pad probes, causing gradual increase in CPU
Last modified: 2017-08-08 17:15:38 UTC
Created attachment 357134 [details] [review] Patch for IDLE probe leak While testing our application it was observed that CPU utilization slowly increased over time, which on low spec (i.e. embedded) hardware caused playback to halt after several hours. This was tracked down to code in adaptivedemux which added an IDLE probe to the elements source pad every time it downloaded a fragment. These probes were never removed meaning an ever-increasing number of probe callbacks had to be dispatched. The attached patch fixes this resource leak by removing the IDLE probe when it is no longer needed. It would probably be more optimal to use the same probe throughout the lifetime of the element but the current logic relies on the fact that the pad calls the probe callback when it is added if the pad is currently idle, and it is not possible to determine this from outside the pad
Comment on attachment 357134 [details] [review] Patch for IDLE probe leak I wonder if just returning GST_PAD_PROBE_REMOVE from the probe would do the trick as well here? As far as I can tell we always wait for the probe to be called.
Hi Tim-Philipp, That's a great suggestion, I didn't think of that. I've tried it and it also fixes the problem of leaking pad probes. I've updated the patch. Tom
Created attachment 357190 [details] [review] Patch for leaking pad probes (2nd attempt)
Many thanks for the patch, pushed to master and 1.12 branch: commit 4064683d36ba8eb8732b904be0bdaedc38b013fc Author: Tom Bailey <tom.bailey@youview.com> Date: Wed Aug 2 18:17:08 2017 +0100 adaptivedemux: Fix leak of pad probes in GstAdaptiveDemuxStream This commit ensures that the idle probe which GstAdaptiveDemuxStream adds to the upstream source pad is removed after use. Previously a new probe was added to the pad whenever a fragment was downloaded, meaning the number of pad probe callbacks being executed increased continually. https://bugzilla.gnome.org/show_bug.cgi?id=785957