[Bug 765728] adaptivedemux: Segfault since "use realtime_clock for waiting for a condition" commit

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Fri Apr 29 17:06:19 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=765728

--- Comment #23 from Tim-Philipp Müller <t.i.m at zen.co.uk> ---
Comment on attachment 327009
  --> https://bugzilla.gnome.org/attachment.cgi?id=327009
adaptivedemux: unschedule clock callback when tasks are ending

Nice catch. At first glance this whole function looks a bit fishy to me though.

There are three question I have:

1) as I understand it, g_cond_wait() may wake up spuriously without anyone
having called g_cond_signal() on it, so g_cond_wait() should always be used in
a loop really. Here we probably want to do { g_cond_wait(); } while
(!timer.fired) or so, no?

2) This means we need to check another variable to see if we were cancelled and
should break out of the loop.

3) It's not clear to me if we can use a stack-allocated GstAdaptiveDemuxTimer
here. The clock callbacks will be called from a different thread, right? So
when we call gst_clock_id_unschedule() as in the patch we have no guarantee
that the timer callback is not currently running in the other thread (waiting
for us to release the lock perhaps), so we might return from the function and
trash our stack before the callback gets a chance to finish if I'm not
mistaken.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list