prevent color conversion for shm src/sink

Erik Rull erik.rull at rdsoftware.de
Mon Apr 20 15:29:41 UTC 2020


Hi Josh,

thanks for the fast reply - and yes, I also understood it that way that the shm
is just a memory buffer of "whatever goes in, goes out".

Josh Doe wrote:
> You shouldn't have to convert to BGRx to use shmsrc/shmsink, those elements
> don't even really have the concept of video, they're agnostic to it, they just
> see buffers that need to be sent. Can you share your sending and receiving pipeline?

> Shared memory is zero-copy, so has the best performance. What kind of throughput
> are you using? And what platform?
> 
> -Josh

CPU is an IMX embedded device, the rest is kind-of LFS.

My pipeline parts look like this - the appsrc / appsink encapsulates some image
processing (special overlay, reformatting, etc.) that I could not solve with
gstreamer - the processing time is far less than 100msec inside and the output
is grayscale:

aravissrc camera-name=x.x.x.x num-buffers=10 exposure=100000 gain-auto=0 !
video/x-raw,format=GRAY8,width=640,height=512,framerate=8/1 ! videoconvert  !
videobalance contrast=1.4 brightness=-0.3 contrast=1.8  ! videoconvert  !
video/x-raw,format=GRAY8 ! appsink name=sink max-buffers=10 drop=1

appsrc name=src stream-type=0 is-live=1 max-bytes=10000000
caps=video/x-raw,format=(string)GRAY8,framerate=8/1,width=401,height=404 !
shmsink render-delay=0 socket-path=/tmp/pad_shm shm-size=10000000
wait-for-connection=0 max-lateness=500000000 buffer-time=0

shmsrc socket-path=/tmp/pad_shm is-live=1 !
video/x-raw,format=(string)BGRx,framerate=(fraction)8/1,pixel-aspect-ratio=(fraction)1/1,interlace-mode=(string)progressive,width=401,height=404
! videoconvert  ! identity name=identity ! ximagesink max-lateness=500000000
name=sink

Maybe I have additional errors somewhere else in the pipeline...

But due to the fact that my appsrc exposes an 8bit image, I would not expect
shmsrc to get out something differently...
At the end - the displayed image is actually grey :-)
The identity at the end I use to count the number of images displayed.
I generate some additional output between appsink and appsrc if I map that right
beside the image, the image is delayed by ~ 2 seconds...

Thanks!

Best regards,

Erik



More information about the gstreamer-devel mailing list