v4l2videoenc/v4l2jpegenc: v4l2jpegenc signals an error after a few frames when used with the gsreamer rtsp server
Describe your issue
When using v4l2jpegenc
as a part of media pipeline of an rtsp server, video streaming interrupts after a few frames, and client is disconnected. If I replace v4l2jpegenc
with jpegenc
in the pipeline, streaming works fine.
Expected Behavior
Streaming mjpeg with gstreamer-rtsp-server using hardware jpeg encoder without errors.
Observed Behavior
After I start test-launch
from rtsp server examples on my board, and connect using gst-launch-1.0 playbin uri=rtsp://192.168.1.10:8554/test
, a few frames are displayed, and the client terminates with message like
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Pipeline is PREROLLED ...
Prerolled, waiting for progress to finish...
Progress: (connect) Connecting to rtsp://svcam-ai.local:8554/test
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Redistribute latency...
Progress: (request) Sending PLAY request
Redistribute latency...
Progress: (request) Sent PLAY request
Redistribute latency...
Redistribute latency...
Redistribute latency...
Got EOS from element "playbin0".
Execution ended after 0:00:02.235261642
Setting pipeline to NULL ...
Freeing pipeline ...
Setup
- OS: Yocto linux, mainline kernel ver. 6.2
- Device: custom Rockchip 3399 based board
- GStreamer Version: 1.23.2.1 (commit 9e2e456d)
Steps to reproduce the bug
The issue can be reproduced using test-launch
from gst-rtsp-server
examples like this:
- Run
./test-launch "( videotestsrc ! video/x-raw,format=NV12 ! v4l2jpegenc ! rtpjpegpay name=pay0 pt=96 )"
- Run
gst-launch-1.0 playbin uri=rtsp://192.168.1.10:8554/test
-
GST_DEBUG=4
log: gstreamer-1.23-rtsp-v4l2jpegenc.txt
Note 1:
If I use ./test-launch "( videotestsrc ! video/x-raw,format=NV12 ! jpegenc ! rtpjpegpay name=pay0 pt=96 )"
instead of the above pipeline, bug doesn't appear (log: gstreamer-1.23-rtsp-jpegenc.txt)
Note 2:
If I use v4l2jpegenc
outside rtsp server, like in gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=360,format=NV12 ! v4l2jpegenc ! rtpjpegpay ! udpsink host=192.168.1.64 port=1234
it works, but some warnings appear (log: gstreamer-1.23-gst-launch-v4l2jpegenc.txt)
Note 3:
This case is also broken on 1.22 branch, though in a slightly different way. But after applying patches from !4235 (merged), the situation becomes identical to that on 1.23.
How reproducible is the bug?
The bug is 100% reproducible.
I'm ready to provide more information or test fixes if needed.