Closed orlovsn closed 2 years ago
This is kind of expected. Rendering into Swing or JavaFX will likely require colour conversion and bringing the video data onto the CPU / into the JVM, to be uploaded back to the GPU.
You can do embedding of the video surface using VideoOverlay. Ideally with PlayBin, although you can use sinks directly. I still haven't got around to putting up an example of that. If you need help, ask on the mailing list and/or contact me via www.codelerity.com depending on the nature of the project and how much code you can share.
I tried forcing rkximagesink as sink:
vc = new GstVideoComponent(new AppSink("rkximagesink"))
That doesn't do what you think it does! That just names an appsink element rkximagesink.
I'm trying to use SwingPlayer example code on Rockchip RK3399 cpu (nanopi M4 board)
When I use pure gstreamer to play 1080 rtsp stream
I get ~20% CPU usage by gstreamer and ~2% by xorg (so GStreamer has hw accel of both h264 and renderer).
Same uri rendered by playbin on GstVideoComponent leads to 100% CPU usage by xorg and 150% by JVM (while MBean threads profiler shows that max cpu usage is caused by GstBus and it is only ~20%)
I tried forcing rkximagesink as sink:
but nothing changed
on SwingPlayer load I get some debug info in console, that I, suppose, is generated by GStreamer:
If I understand correctly, problem is that GstVideoComponent uses VolatileImage for screen rendering, that is not accelerated on most ARMs because lack of opengl support (and gles is not supported by openjdk)
Is there any way to accelerate rendering under xorg while not relying on jvm?
I previously used vlcj (java bindings for libvlc) and they use embedding of video layer approach - is it possible with gst1-java?
p.s. same code under windows 11 gets comparable to pure gstreamer resources usage under load (10+ 1080 streams)
ADDED: Tried FXPlayer on same arm under liberica jdk17 - with default SW renderer I get low CPU usage by Xorg (~2-5%) but high CPU usage by JVM (180%+) for single 1080 stream that is displayed @1fps, with Dprism.order=es2 (opengl es renderer) I get whole 1Gb RAM filled in 2 seconds (Growing pool ES2 Vram Pool target to ...)