GNOME Bugzilla – Bug 603376
rtpsession : g_type_create_instance performance issue : avoid buffer ref
Last modified: 2009-11-30 15:05:46 UTC
Created attachment 148743 [details] [review] copy csrc in glist. Do not ref buffer rtpsession always ref the incoming buffer to process csrc after buffer has been pushed (rtp_session_process_rtp). Problem is that with gstrtpbin, downstream elements include a jitterbuffer which issues a gst_buffer_make_metadata_writable (gst_rtp_jitter_buffer_chain). This gst_buffer_make_metadata_writable always does a metadata copy, because buffer has been reffed peviously. This leads to the known performance issue in g_type_create_instance (gst_buffer_create_sub / gst_mini_object_new). Here is a patch which copies csrc into a glist for further processing, avoiding buffer ref.
Good idea! I changed it a bit to use an array instead of a GList to avoid some allocations (not that CSRCs are very common). commit 07f27f0efd5a866721fd83c6873e7eacc989c0fe Author: Aurelien Grimaud <gstelzz at yahoo dot fr> Date: Mon Nov 30 15:59:50 2009 +0100 rtpsession: avoid buffer ref/unref pairs for CSRCs We ref the buffer before pushing it downstream in order to get the CSRCs of it after pushing. This causes performance problems when downstream elements want to change the metadata because the buffer needs to be subbuffered. Instead, read and store the CSRCs of the buffer in an array before pushing it and process the array after pushing the buffer. This allows us to remove the ref/unref pair. Fixes #603376