Skip to content

Commit 2353bc5

Browse files
committed
driver: usbvideodriver: add support for overlaying FPS
We encourage addition of multiple quality settings for USB Video devices, but there is no easy way to get feedback how many frames per second are actually processed on the receiver side, which could influence which quality settings would be chosen for Labgrid. Let's add a fps parameter to USBVideoDriver::stream() that enables an overlay with FPS statistics if enabled. Signed-off-by: Ahmad Fatoum <[email protected]>
1 parent 9b7c859 commit 2353bc5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ New Features in 25.1
1111

1212
- Guermok HDMI to USB 3.0 capture dongle supported
1313

14+
- The `USBVideoDriver`'s ``stream`` method can now be called with ``fps=True``
15+
to embed an overlay with FPS statistics into the video stream.
16+
1417
Breaking changes in 25.1
1518
~~~~~~~~~~~~~~~~~~~~~~~~
1619
- The deprecated pytest plugin option ``--env-config`` has been removed. Use

labgrid/driver/usbvideodriver.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,15 @@ def get_pipeline(self, path, caps, controls=None):
139139
return pipeline
140140

141141
@Driver.check_active
142-
def stream(self, caps_hint=None, controls=None):
142+
def stream(self, caps_hint=None, controls=None, fps=False):
143143
caps = self.select_caps(caps_hint)
144144
pipeline = self.get_pipeline(self.video.path, caps, controls)
145145

146146
tx_cmd = self.video.command_prefix + ["gst-launch-1.0", "-q"]
147147
tx_cmd += pipeline.split()
148148
rx_cmd = ["gst-launch-1.0", "playbin3", "buffer-duration=0", "uri=fd://0"]
149+
if fps:
150+
rx_cmd += ['video-sink=fpsdisplaysink']
149151

150152
tx = subprocess.Popen(
151153
tx_cmd,

0 commit comments

Comments
 (0)