Skip to content

How to load this in a custom pipeline? #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chriswiggins opened this issue Nov 22, 2020 · 11 comments
Open

How to load this in a custom pipeline? #48

chriswiggins opened this issue Nov 22, 2020 · 11 comments

Comments

@chriswiggins
Copy link

We're trying to load this into our Python pipeline, however using LD_PRELOAD doesn't seem to have an effect. I've tried to load the plugin through the GstRegistry, but this has no effect?

Thanks for the help

@kirushyk
Copy link
Owner

On Linux, if you have gst-instruments installed to /usr/local/ prefix, you have two options:

  1. GStreamer ABI call interception:
  • set LD_PRELOAD environment variable to /usr/local/lib/libgstintercept.so.
  • set GST_DEBUG_DUMP_TRACE_DIR to a folder where to put output trace file.
  • set GST_DEBUG_DUMP_TRACE_FILENAME to a filename you would like to use for your trace.
  1. Hooks with GStreamer plugin:
  • set GST_PLUGIN_PATH to /usr/local/lib/gstreamer-1.0/ (prefix will be taken into account when choosing installation location for plugin)
  • set GST_TRACERS to instruments (filename of plugin is libgstinstruments.so, but not libgstintercept.so).
  • filename will be constructed from top-level bin and .gsttrace suffix.

@jjrugui
Copy link

jjrugui commented May 11, 2021

@kirushyk I followed your instructions in the previous comment (using intercept) and I can't get the trace. I can confirm that I get a trace and that I'm able to get the visualization if I use it on gst-launch.

When using Python, does the pipeline need to be closed gracefully in a specific way in order to get the trace?

@yuyou
Copy link

yuyou commented May 12, 2021

@jjrugui I managed to make it work using the 2nd method:

GST_TRACERS=instruments python3 <your_GST_PY_Code> 

And gst-instruments was installed to the same GST plugin directory, e.g. "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstinstruments.so"

@jjrugui
Copy link

jjrugui commented May 12, 2021

@yuyou awesome! Thanks for the input

I'll be able to test it in ~30 mins. Will report back :)

@jjrugui
Copy link

jjrugui commented May 12, 2021

@yuyou @kirushyk If I use the plugin method I get a segmentation fault. I can see though from the debug that the instruments library is loaded correctly.

Any idea on this? I'll try to investigate the issue and report it back

@jjrugui
Copy link

jjrugui commented May 12, 2021

Note that I'm working on a Nvidia Xavier

@yuyou
Copy link

yuyou commented May 12, 2021

I am not sure if it would be helpful but my GST was built from source (1.18.3) using meson with release=debug.
Is it required to have a GST in debug build or works with the release version?

@jjrugui
Copy link

jjrugui commented May 14, 2021

@yuyou how complex is the pipeline you debugged? Might be a stupid question (I'm pretty new to gstreamer) but are all types of pads compatible with the profiler? @kirushyk

In my case I'm running a fairly complex pipeline with a couple appsink/appsrc so I don't know if some of the problem comes from there. When done with gst-launch I have no problem with getting the trace.

@yuyou
Copy link

yuyou commented May 17, 2021

@jjrugui Hard to define the exact "complex" level :-O) but my pipeline includes elements like udpsrc, glupload/gldownload, and glshader for GLSL shading.

I tested with "appsrc" and it also worked.

The step are as follows:

  1. use a sample code from appsrc
  2. The command: GST_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gstreamer-1.0/ GST_TRACERS=instruments GST_DEBUG_DUMP_TRACE_DIR=. python3 run_appsrc.py
  3. The tracing output is stored at "pipeline0.gsttrace" file and you can use "gst-report" to view it.

ELEMENT                              %CPU   %TIME   TIME
videoconvert0                         40.3   95.5    1.35 s
appsrc0                                1.0    2.3   33.0 ms
autovideosink0-actual-sink-xvimage     0.7    1.7   23.8 ms
queue0                                 0.2    0.5   7.26 ms
autovideosink0                         0.0    0.0      0 ns
pipeline0                              0.0    0.0      0 ns


OS: Ubuntu 18.04
GST: 1.18.3

@jjrugui
Copy link

jjrugui commented May 17, 2021

@yuyou yeah, sorry, not the best phrasing with "complex". I meant as in custom functions in an appsink, so I wasn't sure if that could be an issue but it seems from your test that it's not.

I'll keep investigating and try your suggestions, so as soon as I have some insight I'll share it here.

Thank you very much for your time, highly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@yuyou @chriswiggins @kirushyk @jjrugui and others