GNOME Bugzilla – Bug 345444
Linking to an audioconvert (pad-added callback) multiple times in a pipeline takes a very long time
Last modified: 2006-08-20 19:30:57 UTC
Please describe the problem: In Jokosher we have been experience problems with a delay before playback. After some investigation, the delay is when the gnlcomposition is linked to an audioconvert when responding to pad-added. Attached is a sample script that outlines the problem. The script prints out the link time. Steps to reproduce: 1. Run the script. 2. 3. Actual results: It takes ages to play. Expected results: It plays straight away. Does this happen every time? Yes. Other information:
Created attachment 67719 [details] Test script to demo the bug
Created attachment 67720 [details] Glade file for use with test script
It's caps negotiation going crazy in basetransform.
> opreport -l /opt/gnome/lib/libgstbase-0.10.so CPU: AMD64 processors, speed 1800.38 MHz (estimated) Counted CPU_CLK_UNHALTED events (Cycles outside of halt state) with a unit mask of 0x00 (No unit mask) count 100000 samples % symbol name 6 26.0870 gst_base_transform_transform_caps 4 17.3913 gst_base_transform_getcaps 3 13.0435 .plt 2 8.6957 gst_base_transform_prepare_output_buffer 1 4.3478 __i686.get_pc_thunk.bx 1 4.3478 gst_base_sink_perform_qos 1 4.3478 gst_base_src_change_state 1 4.3478 gst_base_src_get_type 1 4.3478 gst_base_src_start 1 4.3478 gst_base_transform_handle_buffer 1 4.3478 gst_collect_pads_flush 1 4.3478 gst_collect_pads_set_flushing_unlocked what the heck is .plt ? gst_base_transform_transform_caps: : /* we send caps with just one structure to the transform : * function as this is easier for the element */ 3 13.0435 : for (i = 0; i < gst_caps_get_size (caps); i++) { : GstCaps *nth; : 1 4.3478 : nth = gst_caps_copy_nth (caps, i); : GST_DEBUG_OBJECT (trans, "from[%d]: %" GST_PTR_FORMAT, i, nth); 1 4.3478 : temp = klass->transform_caps (trans, direction, nth); : gst_caps_unref (nth); 1 4.3478 : GST_DEBUG_OBJECT (trans, " to[%d]: %" GST_PTR_FORMAT, i, temp); : : temp = gst_caps_make_writable (temp); : gst_caps_append (ret, temp); : } gst_base_transform_getcaps: : /* filtered against our padtemplate */ : templ = gst_pad_get_pad_template_caps (otherpad); : GST_DEBUG_OBJECT (pad, "our template %" GST_PTR_FORMAT, templ); : temp = gst_caps_intersect (caps, templ); : GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, temp); 2 8.6957 : gst_caps_unref (caps); : /* then see what we can transform this to */ : caps = gst_base_transform_transform_caps (trans, : GST_PAD_DIRECTION (otherpad), temp); : GST_DEBUG_OBJECT (pad, "transformed %" GST_PTR_FORMAT, caps); : gst_caps_unref (temp); 1 4.3478 : if (caps == NULL) : goto done; : : /* and filter against the template again */ : templ = gst_pad_get_pad_template_caps (pad); : GST_DEBUG_OBJECT (pad, "our template %" GST_PTR_FORMAT, templ); : temp = gst_caps_intersect (caps, templ); : GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, temp); : gst_caps_unref (caps); : /* this is what we can do */ : caps = temp;
this seems to be one of the culprits: :int :gst_value_compare (const GValue * value1, const GValue * value2) 170 0.3831 :{ /* gst_value_compare total: 5895 13.2854 */ : GstValueTable *table, *best = NULL; : guint i; : 482 1.0863 : if (G_VALUE_TYPE (value1) != G_VALUE_TYPE (value2)) : return GST_VALUE_UNORDERED; : 1802 4.0611 : for (i = 0; i < gst_value_table->len; i++) { 455 1.0254 : table = &g_array_index (gst_value_table, GstValueTable, i); 1189 2.6796 : if (table->type == G_VALUE_TYPE (value1) && table->compare != NULL) { : best = table; : break; : } 1429 3.2205 : if (g_type_is_a (G_VALUE_TYPE (value1), table->type)) { : if (!best || g_type_is_a (table->type, best->type)) : best = table; : } : } : if (best) { 101 0.2276 : return best->compare (value1, value2); : } : : g_critical ("unable to compare values of type %s\n", : g_type_name (G_VALUE_TYPE (value1))); : return GST_VALUE_UNORDERED; 267 0.6017 :}
2006-08-20 Stefan Kost <ensonic@users.sf.net> * libs/gst/base/gstbasetransform.c: (gst_base_transform_transform_caps): Simplify caps to get rid of duplicates, fixes #345444