Latency Measurements
Latency tests
We measure glass-to-glass latency using v4l2src and a video with a timeoverlay. Multiple samples are taken, also we measure latency under different conditions, for example publishing multiple streams or on a one-to-many setup as well as using rrmoqsrc and web-server. These are not perfect measurements but it helps us get a rough idea of the latency.
The video with timeoverlay is generated with the following pipeline:
gst-launch-1.0 -e \
filesrc location=bunny.mp4 ! qtdemux name=d \
d.video_0 ! queue ! decodebin ! videoconvert \
! timeoverlay halignment=left valignment=top time-mode=buffer-time \
! x264enc speed-preset=veryfast bitrate=2500 key-int-max=60 bframes=0 \
! h264parse ! queue ! mux. \
d.audio_0 ! queue ! aacparse ! queue ! mux. \
mp4mux name=mux faststart=true ! filesink location=bunny_with_clock.mp4
Then we use a tee to see the video that being send through moq roughly at the same time:
gst-launch-1.0 -v \
filesrc location=bunny_with_clock.mp4 \
! qtdemux name=demux \
demux.video_0 \
! h264parse \
! tee name=t \
\
t. ! queue \
! h264parse config-interval=-1 \
! rrmoqsink relay-url="http://127.0.0.1:4443" channel=test \
\
t. ! queue \
! vaapidecodebin \
! vaapipostproc \
! xvimagesink
With live videosrc:
gst-launch-1.0 -v \
autovideosrc \
! vaapipostproc ! timeoverlay halignment=left valignment=top \
! tee name=t \
\
t. ! queue \
! vaapipostproc \
! xvimagesink \
\
t. ! queue \
! vaapipostproc \
! timeoverlay halignment=left valignment=top ! vaapih264enc \
! h264parse \
! rrmoqsink relay-url="http://127.0.0.1:4443" channel=test
We consume the video track and check the time difference between the two in the timeoverlay added.
gst-launch-1.0 -v \ rrmoqsrc relay-url=https://127.0.0.1:4443 channel=test name=src \ src.track ! queue \ ! vaapidecodebin \ ! vaapipostproc ! xvimagesink sync=false
For the web-server case with video we use the following pipeline:
gst-launch-1.0 \
filesrc location=../bbb_with_clock_baseline.mp4 ! \
qtdemux name=mux \
mux.video_0 ! tee name=t \
t. ! queue ! \
rrmoqbin relay-mode=local relay-server-host-addr=https://127.0.0.1:4443 \
channel=web-test name=bin sink_0::track-name=video run-web-server=true \
t. ! queue \
! vaapidecodebin \
! vaapipostproc \
! xvimagesink
And with autovideosrc:
gst-launch-1.0 -v \
autovideosrc \
! vaapipostproc ! timeoverlay halignment=left valignment=top \
! tee name=t \
\
t. ! queue \
! vaapipostproc \
! xvimagesink \
\
t. ! queue \
! vaapipostproc \
! timeoverlay halignment=left valignment=top ! x264enc tune=zerolatency speed-preset=ultrafast ! video/x-h264,profile=baseline ! rrmoqbin relay-mode=local relay-server-host-addr=https://127.0.0.1:4443 \
channel=web-test name=bin sink_0::track-name=video run-web-server=true
And view the video in http://127.0.0.1:5173/.
This gives us a set of measuremnets under different conditions:
Peer-to-peer (rrmoqsrc)
| Item | Resolution | Framerate | Bitrate | Latency (Local relay) | Latency (VPN relay) |
|---|---|---|---|---|---|
| Video A | 1280x720 | 24 fps | ~2.17 Mbps | samples: [0.29 s, 0.50 s, 0.65 s] | samples: [0.75 s, 0.83 s, 2.00 s] |
| v4l2src | 640×480 | 30 fps | ~0.5 Mbps | samples: [0.564 s, 0.236 s, 0.5 s] | (xvimagesink sync=false) [0.068 s, 0.1 s, 0.1 s] |
Peer-to-peer (web-server)
| Item | Resolution | Framerate | Bitrate | Latency (Local relay) | Latency (VPN relay) |
|---|---|---|---|---|---|
| Video A | 1280x720 | 24 fps | ~1.99 Mbps | samples: [0.125 s, 0.125 s, 0.084 s] | samples: [0.125 s, 0.125 s, 0.125 s] |
| v4l2src | 640×480 | 30 fps | ~0.5 Mbps | samples: [0.1s, 0.1s, 0.1s] | [0.032 s, 0.1 s, 0.1 s] |
One-to-many (rrmoqsrrc)
For this test we launch a single track to a local relay and get latency measurements from 5 rrmoqsrc elements running simultanously in the same computer.
| Item | Resolution | Framerate | Bitrate | Latency |
|---|---|---|---|---|
| Video A | 1280x720 | 24 fps | ~1.99 Mbps | samples: [0.542 s, 1.50 s, 0.084 s, 0.50 s, 0.792 s] |
One-to-many (web-server)
This test launched a single track with a local relay and 5 web pages consuming the track:
| Item | Resolution | Framerate | Bitrate | Latency |
|---|---|---|---|---|
| Video A | 1280x720 | 24 fps | ~1.99 Mbps | samples: [0.1s, 0.1s, 0.1s. 0.1s, 0.005s] |
One-to-one high traffic
This test runs in a one-to-one setup but we launched multiple tracks 10 tracks (same video and different channel) in the same relay server to see the behavior under higher traffic.
For this test we launch a single track to a local relay and get latency from 5 rrmoqsrc elements running simultanously in the same computer.
| Item | Resolution | Framerate | Bitrate | Latency |
|---|---|---|---|---|
| Video A | 1280x720 | 24 fps | ~2.17 Mbps | samples: [0.833 s, 1.625 s, 1.166 s] |