Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to add a real-time latency display in the projector window using USB? and how to implement it? #4256

Open
zddzxxsmile opened this issue Aug 24, 2023 · 5 comments

Comments

@zddzxxsmile
Copy link

Scrcpy is very usefull to me. However, I wonder the following:
Is it possible to add a real-time latency display in the projector window using USB? and how to implement it?
I can pay for this function.

@rom1v
Copy link
Collaborator

rom1v commented Aug 25, 2023

display in the projector window using USB

Sorry, I don't understand. Could you elaborate?

@zddzxxsmile
Copy link
Author

display in the projector window using USB
Sorry, I don't understand. Could you elaborate?

It is as the following:

In the computer screen, there is a mobile phone projection window (via USB). I want to add the real-time delayed display (latency) in the projection window (like 177 ms or 120 ms, a dynamic number show the latency between phone and display in the computer via USB connection)

figure

Is it possible for scrcpy?

Thanks very much.

@rom1v
Copy link
Collaborator

rom1v commented Aug 25, 2023

It's very difficult to get a precise, accurate and meaningful value.

First, the clock difference between the device and the computer must be estimated (with some NTP-like protocol), this might introduce some error.

But there are other sources of error.

For example, there might be a difference between the timestamp reported by MediaCodec and the "real" time when the image becomes visible on the physical Android device display.

Also, on the computer side, when we draw a frame at some instant t, it will be actually "sent" at the next vblank (at 60Hz, it's every ~16.7ms). So if the frame is drawn 1ms after the previous vblank, there are additional 15ms not taken into account. After this, the compositor may add some delay, and the physical display may also add delay.

Instead, it is more meaningful to measure the "glass-to-glass latency", by filming the device display and the computer display at the same time (basically what I did here, but with very poor hardware).

@zddzxxsmile
Copy link
Author

It's very difficult to get a precise, accurate and meaningful value.

First, the clock difference between the device and the computer must be estimated (with some NTP-like protocol), this might introduce some error.

But there are other sources of error.

For example, there might be a difference between the timestamp reported by MediaCodec and the "real" time when the image becomes visible on the physical Android device display.

Also, on the computer side, when we draw a frame at some instant t, it will be actually "sent" at the next vblank (at 60Hz, it's every ~16.7ms). So if the frame is drawn 1ms after the previous vblank, there are additional 15ms not taken into account. After this, the compositor may add some delay, and the physical display may also add delay.

Instead, it is more meaningful to measure the "glass-to-glass latency", by filming the device display and the computer display at the same time (basically what I did here, but with very poor hardware).

Dear rom1v,

I konw it is difficult to get a precise as 1 ms, we do not need so much precision. Is it possible for scrcpy as precise as 30-70 ms to show the real-time latency?

@snowboyz0825
Copy link

In theory you could create a timer of some sort android side and then look at it on both monitors, and this would show you the latency by subtracting the PC's side from phones's side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants