Suggest to remove "videorate" and "videoscale" filters from the video_save_bin



Hi all,

I recently found when cheese was recording video from a webcam at
640x480 resolution on a netbook (e.g. Asus EeePC 901), the CPU occupancy
was up to 100% and system response was very slow. The theora and vorbis
encoder are expensive on Atom processor. But I found the two filters
video_save_rate and video_save_scale in the video_save_bin pipeline seem
useless, so I removed them and then I got the CPU occupancy down to ~80%
(20% off) and the system response became normal.

The patch is as below:

--------------------------------------------------------------------------

diff -Nur cheese-2.28.0/src/cheese-webcam.c
cheese-2.28.0-new/src/cheese-webcam.c
--- cheese-2.28.0/src/cheese-webcam.c   2009-09-19 02:45:08.000000000
+0800
+++ cheese-2.28.0-new/src/cheese-webcam.c       2009-10-20
16:20:32.000000000 +0800
@@ -1112,7 +1112,7 @@
   CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);

   GstElement *audio_queue, *audio_convert, *audio_enc;
-  GstElement *video_save_csp, *video_save_rate, *video_save_scale,
*video_enc;
+  GstElement *video_save_csp, *video_enc;
   GstElement *mux;
   GstPad     *pad;
   gboolean    ok;
@@ -1149,20 +1149,6 @@
     g_object_set (video_enc, "keyframe-force", 1, NULL);
   }

-  if ((video_save_rate = gst_element_factory_make ("videorate",
"video_save_rate")) == NULL)
-  {
-    cheese_webcam_set_error_element_not_found (error, "videorate");
-  }
-  if ((video_save_scale = gst_element_factory_make ("videoscale",
"video_save_scale")) == NULL)
-  {
-    cheese_webcam_set_error_element_not_found (error, "videoscale");
-  }
-  else
-  {
-    /* Use bilinear scaling */
-    g_object_set (video_save_scale, "method", 1, NULL);
-  }
-
   if ((mux = gst_element_factory_make ("oggmux", "mux")) == NULL)
   {
     cheese_webcam_set_error_element_not_found (error, "oggmux");
@@ -1195,8 +1181,7 @@
   ok = gst_element_link_many (priv->audio_source, audio_queue,
audio_convert,
                               audio_enc, mux, priv->video_file_sink,
NULL);

-  ok &= gst_element_link_many (video_save_csp, video_save_rate,
video_save_scale, video_enc,
-                               NULL);
+  ok &= gst_element_link_many (video_save_csp, video_enc, NULL);
   ok &= gst_element_link (video_enc, mux);

   if (!ok)

-------------------------------------------------------------------------------

Thanks,
Bin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]