pidgin.vv: 3b236799: Limit the size and framerate of the vide...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Thu Feb 26 04:10:30 EST 2009


-----------------------------------------------------------------
Revision: 3b236799e410ccae0c92ace2bc5089ecbcfa55a5
Ancestor: e090488f9c17a046779cefd92da66b52e9b854cb
Author: maiku at soc.pidgin.im
Date: 2009-02-26T06:08:51
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/3b236799e410ccae0c92ace2bc5089ecbcfa55a5

Modified files:
        libpurple/media.c

ChangeLog: 

Limit the size and framerate of the video source.

-------------- next part --------------
============================================================
--- libpurple/media.c	146776267ab76fabba7e9f8398ef4e9d75e37763
+++ libpurple/media.c	55ac97abcfe0847b98e596d717f4094e313e4154
@@ -1606,9 +1606,10 @@ purple_media_video_init_src(GstElement *
 void
 purple_media_video_init_src(GstElement **sendbin)
 {
-	GstElement *src;
+	GstElement *src, *videoscale, *capsfilter;
 	GstPad *pad;
 	GstPad *ghost;
+	GstCaps *caps;
 	const gchar *video_plugin = purple_prefs_get_string(
 			"/purple/media/video/plugin");
 	const gchar *video_device = purple_prefs_get_string(
@@ -1618,14 +1619,23 @@ purple_media_video_init_src(GstElement *
 
 	*sendbin = gst_bin_new("purplesendvideobin");
 	src = gst_element_factory_make(video_plugin, "purplevideosource");
-	gst_bin_add(GST_BIN(*sendbin), src);
+	videoscale = gst_element_factory_make("videoscale", NULL);
+	capsfilter = gst_element_factory_make("capsfilter", NULL);
 
+	/* It was recommended to set the size < 352x288 and framerate < 20 */
+	caps = gst_caps_from_string("video/x-raw-yuv , width=[250,350] , "
+			"height=[200,275] , framerate=[10/1,20/1]");
+	g_object_set(G_OBJECT(capsfilter), "caps", caps, NULL);
+
+	gst_bin_add_many(GST_BIN(*sendbin), src, videoscale, capsfilter, NULL);
+	gst_element_link_many(src, videoscale, capsfilter, NULL);
+
 	if (!strcmp(video_plugin, "videotestsrc")) {
 		/* unless is-live is set to true it doesn't throttle videotestsrc */
 		g_object_set (G_OBJECT(src), "is-live", TRUE, NULL);
 	}
 
-	pad = gst_element_get_static_pad(src, "src");
+	pad = gst_element_get_static_pad(capsfilter, "src");
 	ghost = gst_ghost_pad_new("ghostsrc", pad);
 	gst_object_unref(pad);
 	gst_element_add_pad(*sendbin, ghost);


More information about the Commits mailing list