librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

Poor streaming performance with v2.50.0 and RSUSB backend

Open tpwrules opened this issue 3 years ago • 8 comments
trafficstars

Required Info
Camera Model L515
Firmware Version 1.5.8.1
Operating System & Version Ubuntu 20.04
Kernel Version (Linux Only) 5.4.0
Platform PC
SDK Version 2.50.0
Language Realsense Viewer

Issue Description

When trying to stream RGB video from an L515 using the RSUSB backend and realsense-viewer in the new v2.50.0 SDK, the video is jerky and the dropped frame percentage hovers between 10-20%. Additionally, the kernel log is spammed with messages indicating the connection of a new uvcvideo device, as if the camera is constantly disconnecting and reconnecting every second or so. The log pane in realsense-viewer doesn't show anything.

If I switch to the v2.49.0 SDK, try to stream RGB video from the same camera, and make no other changes to the setup, the video stream is rock solid and no frames are dropped.

tpwrules avatar Jan 20 '22 22:01 tpwrules

Hi @tpwrules The RSUSB backend had changes to it implemented in SDK 2.50.0 - as described in https://github.com/IntelRealSense/librealsense/pull/9821 - and so this might be affecting your particular computer (I have not seen similar reports about 2.50.0 from other RealSense users).

MartyG-RealSense avatar Jan 21 '22 08:01 MartyG-RealSense

I only have this issue on 2.50.0. 2.49.0 and below work fine.

I tested reverting PR #9821 and that fixes the issue, so I think that PR might need revision.

tpwrules avatar Feb 07 '22 20:02 tpwrules

It looks like the libusb object is destructed a couple times a second at least when using realsense-viewer, which means the device is constantly detached and reattached from v4l, causing these glitches.

@doronhi

tpwrules avatar Feb 07 '22 20:02 tpwrules

@tpwrules I can reproduce the issue you've got. Will track this as a bug. Any update will let you know. Thanks!

RealSenseSupport avatar Feb 11 '22 09:02 RealSenseSupport

@MartyG-RealSense @RealSenseSupport. Hi, is this issue solved in the latest librealsense v2.51.1? I have the same problem using a Raspberry Pi 4 with D435i. The kernel log shows that the camera repeatedly connects and disconnects, causing severe frame drops. If I use ROS package usb_cam, instead of pyrealsense or realsense-ros, I observe no frame drop at all. I can also confirm that downgrading librealsense to v2.49.0 solves the problem, but after using the RSUSB backend, applications using the v4l backend can't find the device.

PeixinC avatar Aug 30 '22 01:08 PeixinC

Hi @PeixinC A fix for RSUSB / V4L interoperability was implemented in 2.50.0.

image

Using 2.50.0 may resolve your problem with the V4L backend not finding the device when using the RSUSB backend. However, you have been experiencing repeated disconnects and reconnects with 2.50.0. Is that correct, please?

There have not been SDK updates to RSUSB in 2.51.1 according to the SDK release notes.

If you are confident in editing scripts and would like 2.49.0's stability and 2.50.0's interoperability, conceivably you could edit the handle-libusb.h file of the 2.49.0 source code to recreate the changes made in 2.50.0 (shown in green in the link below) and then build that amended 2.49.0 source code with the RSUSB backend.

https://github.com/IntelRealSense/librealsense/commit/ee735eaedf1e0846166842cf264d35e48b663de7

MartyG-RealSense avatar Aug 30 '22 09:08 MartyG-RealSense

Thanks for the information. Yes, you are correct. But according to tpwrules who found that

I only have this issue on 2.50.0. 2.49.0 and below work fine.

I tested reverting PR #9821 and that fixes the issue, so I think that PR might need revision.

I will experience frame drops if I added the code in green to 2.49.0 source code. Please tell me if I misunderstand anything.

PeixinC avatar Aug 30 '22 16:08 PeixinC

My theory would be that if 2.49.0 has good performance for you but has the V4L interoperability problem then adding the code in green may give good performance and resolve the V4L issue.

MartyG-RealSense avatar Aug 31 '22 08:08 MartyG-RealSense