After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 796478 - avfvideosrc Consuming Too much CPU
avfvideosrc Consuming Too much CPU
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.x
Other Mac OS
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-06-01 08:10 UTC by Prafulla Kumar Singh
Modified: 2018-11-03 14:24 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Prafulla Kumar Singh 2018-06-01 08:10:24 UTC
Compare to videotestsrc, avfvideosrc taking too much CPU.
pipeline with videotestsrc CPU use :  ~ 28.2%
pipeline with avfvideosrc CPU use  :   ~ 207.2%


Following are terminal log for reference:




ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps
  PID TTY           TIME CMD
 1111 ttys000    0:00.49 -bash
12116 ttys000    0:20.14 ./objs/srs -c ./conf/srs.conf
12196 ttys000    0:00.06 tail -f objs/srs.log
14198 ttys002    0:00.46 -bash
22944 ttys002    0:03.17 gst-launch-1.0 videotestsrc is-live=true ! videoconvert ! x264enc tune=zerolatency ! video/x-h264 ! mpegtsmux name=mux ! queu
22733 ttys003    0:00.15 -bash
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps -p 22944 -o %cpu,%mem
 %CPU %MEM
 25.6  0.4
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps -p 22944 -o %cpu,%mem
 %CPU %MEM
 28.2  0.4
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps -p 22944 -o %cpu,%mem
 %CPU %MEM
 28.5  0.4
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps
  PID TTY           TIME CMD
 1111 ttys000    0:00.49 -bash
12116 ttys000    0:20.15 ./objs/srs -c ./conf/srs.conf
12196 ttys000    0:00.06 tail -f objs/srs.log
14198 ttys002    0:00.47 -bash
22951 ttys002    0:11.46 gst-launch-1.0 avfvideosrc ! videoconvert ! x264enc tune=zerolatency ! video/x-h264 ! mpegtsmux name=mux ! queue ! udpsink ho
22733 ttys003    0:00.17 -bash
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps -p 22951 -o %cpu,%mem
 %CPU %MEM
211.1  0.7
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps -p 22951 -o %cpu,%mem
 %CPU %MEM
207.2  0.7
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ gst-inspect-1.0 --version
gst-inspect-1.0 version 1.14.0
GStreamer 1.14.0
Comment 1 Matthew Waters (ystreet00) 2018-06-01 08:17:17 UTC
Thanks for the report!

Unfortunately, it seems that you're not testing with the exact same frame sizes which can impact the CPu performance.  E.g. videotestsrc will by default choose a frame size of 320x240.  avfvideosrc most likely chose the highest frame size supported by your camera/screen which may be 720p or higher.

Also, have you performed some profiling results that would point to a specific place to look into for these performance issues?
Comment 2 Prafulla Kumar Singh 2018-06-01 10:25:51 UTC
Still The CPU use is up by 75%. Similar issue is also in iOS as with avfvideosrc increase CPU use by 75%, with video resolution 240*320.


Logs:

ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps
  PID TTY           TIME CMD
 1111 ttys000    0:00.49 -bash
12116 ttys000    0:22.79 ./objs/srs -c ./conf/srs.conf
12196 ttys000    0:00.06 tail -f objs/srs.log
14198 ttys002    0:01.04 -bash
23531 ttys002    0:12.14 gst-launch-1.0 avfvideosrc ! video/x-raw,width=640,height=480 ! videoconvert ! x264enc tune=zerolatency ! video/x-h264 ! mpegtsmux name=mux ! queue ! udpsink host=127.0.0.1 port=
22733 ttys003    0:00.25 -bash
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps -p 23531 -o %cpu,%mem
 %CPU %MEM
131.9  0.5
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps -p 23531 -o %cpu,%mem
 %CPU %MEM
126.9  0.5
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps
  PID TTY           TIME CMD
 1111 ttys000    0:00.49 -bash
12116 ttys000    0:23.16 ./objs/srs -c ./conf/srs.conf
12196 ttys000    0:00.07 tail -f objs/srs.log
14198 ttys002    0:01.16 -bash
23704 ttys002    0:02.25 gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480 ! videoconvert ! x264enc tune=zerolatency ! video/x-h264 ! mpegtsmux name=mux ! queue ! udpsink host=127.0.0.1 port
22733 ttys003    0:00.26 -bash
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps -p 23704 -o %cpu,%mem
 %CPU %MEM
 46.8  0.4
Comment 3 Prafulla Kumar Singh 2018-06-01 10:26:38 UTC
Still The CPU use is up by 75%. Similar issue is also in iOS as with avfvideosrc increase CPU use by 75%, with video resolution 240*320.


Logs:

ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps
  PID TTY           TIME CMD
 1111 ttys000    0:00.49 -bash
12116 ttys000    0:22.79 ./objs/srs -c ./conf/srs.conf
12196 ttys000    0:00.06 tail -f objs/srs.log
14198 ttys002    0:01.04 -bash
23531 ttys002    0:12.14 gst-launch-1.0 avfvideosrc ! video/x-raw,width=640,height=480 ! videoconvert ! x264enc tune=zerolatency ! video/x-h264 ! mpegtsmux name=mux ! queue ! udpsink host=127.0.0.1 port=
22733 ttys003    0:00.25 -bash
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps -p 23531 -o %cpu,%mem
 %CPU %MEM
131.9  0.5
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps -p 23531 -o %cpu,%mem
 %CPU %MEM
126.9  0.5
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps
  PID TTY           TIME CMD
 1111 ttys000    0:00.49 -bash
12116 ttys000    0:23.16 ./objs/srs -c ./conf/srs.conf
12196 ttys000    0:00.07 tail -f objs/srs.log
14198 ttys002    0:01.16 -bash
23704 ttys002    0:02.25 gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480 ! videoconvert ! x264enc tune=zerolatency ! video/x-h264 ! mpegtsmux name=mux ! queue ! udpsink host=127.0.0.1 port
22733 ttys003    0:00.26 -bash
ADFGTECHs-MacBook-Pro-2:iOSGstreamerClient prafullasingh$ ps -p 23704 -o %cpu,%mem
 %CPU %MEM
 46.8  0.4
Comment 4 Julien Isorce 2018-06-02 04:23:25 UTC
Can you compare with cpu usage for gst-launch-1.0 avfvideosrc ! fakesink -v ?
Comment 5 Prafulla Kumar Singh 2018-06-05 07:48:46 UTC
ADFGTECHs-MacBook-Pro-2:~ prafullasingh$ ps
  PID TTY           TIME CMD
11007 ttys001    0:00.02 -bash
11013 ttys001    0:05.78 gst-launch-1.0 avfvideosrc ! fakesink -v
11016 ttys002    0:00.02 -bash
10691 ttys003    0:00.04 -bash
10992 ttys003    0:14.12 ffplay rtmp://192.168.11.210/live/livestream2
ADFGTECHs-MacBook-Pro-2:~ prafullasingh$ ps -p 11013 -o %cpu,%mem
 %CPU %MEM
 12.2  0.5


Above are the result you were seeking. Apologies for the delay.

Also, I am able to reduce CPU use to ~50% if I use Appsrc and push camera images with 20 fps.
Comment 6 GStreamer system administrator 2018-11-03 14:24:53 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/724.