GNOME Bugzilla – Bug 632778
Optimisations to GstBaseSink
Last modified: 2010-12-03 14:16:10 UTC
These patches provide the following optimisations * Use an atomic integer for checking whether we should store the last_buffer or not (instead of taking/releasing a lock for nothing) * Avoid checking the type of miniobjects again and again * Avoid creating/destroying GstClockID and instead re-use a cached one
Created attachment 172911 [details] [review] basesink: Switch enable_last_buffer to an atomic int Avoids having to take a lock to read/write it.
Created attachment 172912 [details] [review] basesink: Pass along miniobject type through various functions Avoids doing useless GST_IS_*
Created attachment 172913 [details] [review] gstclock: New API to re-use a single shot GstClockID API: gst_clock_single_shot_id_reinit
Created attachment 172914 [details] [review] basesink: Re-using GstClockID instead of constantly recreating one Makes _sink_wait_clock at least 2 times faster.
Review of attachment 172911 [details] [review]: Looks good ::: libs/gst/base/gstbasesink.c @@ +238,2 @@ /* the last buffer we prerolled or rendered. Useful for making snapshots */ + gint enable_last_buffer; /* atomic */ Shouldn't this be marked as volatile?
Review of attachment 172912 [details] [review]: ::: libs/gst/base/gstbasesink.c @@ +2221,3 @@ + obj_type = _PR_IS_EVENT; + else if (GST_IS_BUFFER_LIST (obj)) + obj_type = _PR_IS_BUFFERLIST; Maybe add a "else g_return_if_reached()" here @@ +3120,3 @@ + ret = + gst_base_sink_render_object (basesink, pad, + GST_IS_BUFFER (o) ? _PR_IS_BUFFER : _PR_IS_EVENT, o); This could be a bufferlist too here, right? @@ +3163,3 @@ * This function takes ownership of obj. + * + * Note: Only GstEvent seem to be passed to this private method Maybe add an assertion for this here
Review of attachment 172913 [details] [review]: Looks good, I'll add the same for periodic clock ids after you pushed this :)
Review of attachment 172914 [details] [review]: Looks good but the cache clock id is not unreffed in PAUSED->READY or READY->NULL or finalize or something
commit ece40dacbc0ae6842e66b2665ee6767b56fa9d39 Author: Edward Hervey <bilboed@bilboed.com> Date: Wed Oct 20 17:41:28 2010 +0200 basesink: Re-using GstClockID instead of constantly recreating one Makes _sink_wait_clock at least 2 times faster. https://bugzilla.gnome.org/show_bug.cgi?id=632778 commit b4285611ad177b67dd32c5022b62d255b5cdd5f5 Author: Edward Hervey <bilboed@bilboed.com> Date: Wed Oct 20 17:40:43 2010 +0200 gstclock: New API to re-use a single shot GstClockID API: gst_clock_single_shot_id_reinit https://bugzilla.gnome.org/show_bug.cgi?id=632778 commit 7115b77aaba7a49f1a8bf9ba4bbc34c4609ed0c5 Author: Edward Hervey <bilboed@bilboed.com> Date: Wed Oct 20 13:52:02 2010 +0200 basesink: Pass along miniobject type through various functions Avoids doing useless GST_IS_* https://bugzilla.gnome.org/show_bug.cgi?id=632778 commit 606e59468dd176a5352961576d4c937751f66b58 Author: Edward Hervey <bilboed@bilboed.com> Date: Wed Oct 20 13:08:08 2010 +0200 basesink: Switch enable_last_buffer to an atomic int Avoids having to take a lock to read/write it. https://bugzilla.gnome.org/show_bug.cgi?id=632778