alexeyvasilyev / rtsp-client-android

Lightweight RTSP client library for Android
Apache License 2.0
210 stars 54 forks source link

Verry high video latency #75

Open MrGaintsquirrel opened 2 months ago

MrGaintsquirrel commented 2 months ago

Hi Alexeyvasilyev,

Currently I am working on a project where I need a low latency (less than 200ms) video connection to a IP camera so I thought of using this library because it sayed that it can do that. However when I use the rtspsurfaceview with the kotlin code below it like in the example in the readme I get a latency of roughly 2 seconds. Am I doing something wrong or are there more settings that I can do to get a lower latency?

Kind regards,

doron2402 commented 6 days ago

@MrGaintsquirrel any luck with it? I'm looking at the same issue.

MrGaintsquirrel commented 6 days ago

@doron2402 no unfortunately not. I did confirm that changing the android device to a more modern one doesn't fix the issue. at some point i got the latency down to 500ms but that was using vlclib.

alexeyvasilyev commented 5 days ago

Latency can be caused by hardware decoder and can be Android device specific.

  1. Try to use another Android device model.
  2. Try to use software decoder instead. In VideoDecodeThread.kt change to var decoder = try { createVideoDecoderAndStart(DecoderType.HARDWARE) ...