[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-devel
Subject:    Re: rtspsrc cpu optimization
From:       Eloi Bail <eloi.bail () gmail ! com>
Date:       2014-10-28 17:24:06
Message-ID: CA+wWfq5FW-Nbnt_7qW==-ofgU2-azvoAGH+g9G3Juy6DPUs=Hw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Fri, Oct 24, 2014 at 5:00 AM, Tim Müller <tim@centricular.com> wrote:
> If you can upgrade your GLib version to 2.42.x, or apply the patches
> from this bug:
>
> https://bugzilla.gnome.org/show_bug.cgi?id=730807
>
> that might give you some easy performance improvements already.
Thanks for your help. I switched to glib 2.42.0 and do not see significant
CPU improvement so far.

I remade some perf stat measures  (*http://fpaste.org/145793/50742514/
<http://fpaste.org/145793/50742514/>*)
You can see that the whole pipeline context switch is 0.005 M/sec. udpsrc
(RTP packets reader) take 0.004 M/sec.

Using perf top again I do not see any particular function consuming CPU (
see *http://fpaste.org/145795/45076731/
<http://fpaste.org/145795/45076731/>*) Do you agree with that ?
Adding a small sleep allow me to save 4-5% on udpsrc (see patch in
attachment).

I checked the resulting mkv file. No frames are dropped using the
workaround. I would like to avoid the use of sleep but it looks like I do
not have other simpler solution for the moment.

Please feel free to advice me.
Cheers,

[Attachment #5 (text/html)]

<div dir="ltr">On Fri, Oct 24, 2014 at 5:00 AM, Tim Müller &lt;<a \
href="mailto:tim@centricular.com">tim@centricular.com</a>&gt; wrote:<br>&gt; If you \
can upgrade your GLib version to 2.42.x, or apply the patches<br>&gt; from this \
bug:<br>&gt;<br>&gt; <a \
href="https://bugzilla.gnome.org/show_bug.cgi?id=730807">https://bugzilla.gnome.org/show_bug.cgi?id=730807</a><br>&gt;<br>&gt; \
that might give you some easy performance improvements already.<br>Thanks for your \
help. I switched to glib 2.42.0 and do not see significant CPU improvement so \
far.<br><br>I remade some perf stat measures   (<b><a \
href="http://fpaste.org/145793/50742514/">http://fpaste.org/145793/50742514/</a></b>)<br>You \
can see that the whole pipeline context switch is 0.005 M/sec. udpsrc (RTP packets \
reader) take 0.004 M/sec.<br><br>Using perf top again I do not see any particular \
function consuming CPU ( see <b><a \
href="http://fpaste.org/145795/45076731/">http://fpaste.org/145795/45076731/</a></b>) \
Do you agree with that ?<br>Adding a small sleep allow me to save 4-5% on udpsrc (see \
patch in attachment).<div><br></div><div>I checked the resulting mkv file. No frames \
are dropped using the workaround. I would like to avoid the use of sleep but it looks \
like I do not have other simpler solution for the \
moment.</div><div><br></div><div>Please feel free to advice \
me.</div><div>Cheers,</div></div>

--001a11c17b7e1d3ddf05067eeae7--


["0001-basesrc-workaround-to-save-CPU-in-udpsrc.patch" (text/x-patch)]

From cc06f3d1e9c2daa468e0e09a3c044baf36ff808f Mon Sep 17 00:00:00 2001
From: Eloi BAIL <eloi.bail@savoirfairelinux.com>
Date: Tue, 28 Oct 2014 11:19:16 -0400
Subject: [PATCH] basesrc: workaround to save CPU in udpsrc

Add of 1ms sleep before calling create function.
Using this it allows to save 4-5% CPU on pipeline rtpsrc ! fakesink
---
 libs/gst/base/gstbasesrc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c
index eb0918c..5e7a75f 100644
--- a/libs/gst/base/gstbasesrc.c
+++ b/libs/gst/base/gstbasesrc.c
@@ -2389,6 +2389,10 @@ again:
 
   res_buf = in_buf = *buf;
 
+  /* FIXME: workaround to save some CPU in udpsrc
+   * sleep 1ms before reading sockets. */
+  usleep (1000);
+
   ret = bclass->create (src, offset, length, &res_buf);
 
   /* The create function could be unlocked because we have a pending EOS. It's
-- 
1.9.1


[Attachment #7 (text/plain)]

_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic