]> git.0d.be Git - empathy.git/commitdiff
Change videosrc element ordering
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Tue, 14 Sep 2010 06:38:17 +0000 (07:38 +0100)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>
Tue, 14 Sep 2010 06:38:17 +0000 (07:38 +0100)
GStreamers basetransform has a nasty issue where its caps negotiation doesn't
keep the ordering of caps when unioning, as a result of this linking the
pipeline as "<src> !  videoscale ! colorspace ! video/x-raw-yuv" means at the
<src> element yuv is no longer preferred.

Changing the pipeline to be "<src> ! colorspace ! videoscale ! video/x-raw-yuv"
forces the videoscale to only negotiate video/x-raw-yuv, which in turns ensures
the colorspace and <src> element pick the right colorspace.

In combination with emulated formats in v4l2src picking the wrong colorspace
causes quite a performance hit (the src would do a color conversion in libv4l,
while the colorspace element would later convert it back to a colorspace
actually native to the src device!)

libempathy-gtk/empathy-video-src.c

index 9c7b28fd28a71774c6fa990e26663fabdc1fc756..5c865daaa7f38689a502c08092afe55a5b34b015 100644 (file)
@@ -146,10 +146,22 @@ empathy_video_src_init (EmpathyGstVideoSrc *obj)
   g_debug ("Current video src caps are : %s", str);
   g_free (str);
 
   g_debug ("Current video src caps are : %s", str);
   g_free (str);
 
+  if ((element = empathy_gst_add_to_bin (GST_BIN (obj),
+      element, "ffmpegcolorspace")) == NULL)
+    g_error ("Failed to add \"ffmpegcolorspace\" (gst-plugins-base missing?)");
+
   if ((element = empathy_gst_add_to_bin (GST_BIN (obj),
       element, "videoscale")) == NULL)
     g_error ("Failed to add \"videoscale\", (gst-plugins-base missing?)");
 
   if ((element = empathy_gst_add_to_bin (GST_BIN (obj),
       element, "videoscale")) == NULL)
     g_error ("Failed to add \"videoscale\", (gst-plugins-base missing?)");
 
+  if ((element = empathy_gst_add_to_bin (GST_BIN (obj),
+      element, "capsfilter")) == NULL)
+    g_error (
+      "Failed to add \"capsfilter\" (gstreamer core elements missing?)");
+
+  g_object_set (G_OBJECT (element), "caps", caps, NULL);
+
+
   /* optionally add postproc_tmpnoise to improve the performance of encoders */
   element_back = element;
   if ((element = empathy_gst_add_to_bin (GST_BIN (obj),
   /* optionally add postproc_tmpnoise to improve the performance of encoders */
   element_back = element;
   if ((element = empathy_gst_add_to_bin (GST_BIN (obj),
@@ -159,17 +171,6 @@ empathy_video_src_init (EmpathyGstVideoSrc *obj)
       element = element_back;
     }
 
       element = element_back;
     }
 
-  if ((element = empathy_gst_add_to_bin (GST_BIN (obj),
-      element, "ffmpegcolorspace")) == NULL)
-    g_error ("Failed to add \"ffmpegcolorspace\" (gst-plugins-base missing?)");
-
-  if ((element = empathy_gst_add_to_bin (GST_BIN (obj),
-      element, "capsfilter")) == NULL)
-    g_error (
-      "Failed to add \"capsfilter\" (gstreamer core elements missing?)");
-
-  g_object_set (G_OBJECT (element), "caps", caps, NULL);
-
   src = gst_element_get_static_pad (element, "src");
   g_assert (src != NULL);
 
   src = gst_element_get_static_pad (element, "src");
   g_assert (src != NULL);