Skip to content

Commit 3fb5a4b

Browse files
authored
Fix: tests: stabilize gst video/audio validation suites (#1347)
- teach GstreamerApp to handle I422_10LE properly: explicit caps, per-format blocksize calculation, and RX pixel-format remapping so rawvideoparse gaps stop breaking UHD fixtures - normalize audio-cap names on both TX and RX so the st30 pipeline request the PCM width the plugin expects - guard the single-host tests against missing SR-IOV VFs and split TX/RX VF usage to avoid NIC contention - update the single- and dual-host video resolution suites to clone media descriptors, only request v210 when the width is divisible by six, and keep the 720p xfail scoped to its true height-based condition
1 parent 211c985 commit 3fb5a4b

File tree

4 files changed

+98
-37
lines changed

4 files changed

+98
-37
lines changed

tests/validation/mtl_engine/GstreamerApp.py

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import re
77
import time
8+
from typing import Optional
89

910
from mtl_engine import ip_pools
1011

@@ -68,6 +69,16 @@ def setup_gstreamer_plugins_paths(build):
6869
return ":".join(plugin_paths)
6970

7071

72+
def calculate_frame_size(pixel_format: str, width: int, height: int) -> Optional[int]:
73+
"""Return the byte size of a single frame for formats that lack parser support."""
74+
75+
format_frame_size = {
76+
"I422_10LE": width * height * 4,
77+
}
78+
79+
return format_frame_size.get(pixel_format)
80+
81+
7182
def fract_format(framerate: str) -> str:
7283
"""
7384
Convert framerate to proper fractional format for GStreamer.
@@ -139,8 +150,22 @@ def setup_gstreamer_st20p_tx_pipeline(
139150
]
140151
)
141152
elif format == "I422_10LE":
153+
# Apply explicit caps instead of rawvideoparse, which lacks this format
154+
caps = (
155+
f"video/x-raw,format={format},height={height},"
156+
f"width={width},framerate={framerate}"
157+
)
158+
frame_size = calculate_frame_size(format, width, height)
159+
filesrc_args = ["filesrc", f"location={input_path}"]
160+
if frame_size:
161+
filesrc_args.append(f"blocksize={frame_size}")
142162
pipeline_command.extend(
143-
["filesrc", f"location={input_path}", f"blocksize={width * height * 10}"]
163+
filesrc_args
164+
+ [
165+
"!",
166+
caps,
167+
"!",
168+
]
144169
)
145170

146171
pipeline_command.extend(["mtl_st20p_tx", f"tx-queues={tx_queues}"])
@@ -182,14 +207,15 @@ def setup_gstreamer_st20p_rx_pipeline(
182207
)
183208

184209
framerate = fract_format(framerate)
210+
mtl_pixel_format = map_gstreamer_to_mtl_pixel_format(format)
185211

186212
# st20 rx GStreamer command line
187213
pipeline_command = [
188214
"gst-launch-1.0",
189215
"-v",
190216
"mtl_st20p_rx",
191217
f"rx-queues={rx_queues}",
192-
f"rx-pixel-format={format}",
218+
f"rx-pixel-format={mtl_pixel_format}",
193219
f"rx-height={height}",
194220
f"rx-width={width}",
195221
f"rx-fps={framerate}",
@@ -720,21 +746,41 @@ def video_format_change(file_format):
720746
return file_format
721747

722748

749+
def map_gstreamer_to_mtl_pixel_format(file_format: str) -> str:
750+
"""Translate GStreamer caps names into the strings expected by the MTL plugin."""
751+
752+
format_map = {
753+
"I422_10LE": "YUV422PLANAR10LE",
754+
}
755+
756+
return format_map.get(file_format, file_format)
757+
758+
723759
def audio_format_change(file_format, rx_side: bool = False):
760+
"""Translate GST caps strings to the plugin naming conventions."""
761+
762+
fmt = (file_format or "").lower()
763+
724764
if rx_side:
725-
if file_format == "s8":
726-
return "PCM8"
727-
elif file_format == "s16le":
728-
return "PCM16"
729-
else:
730-
return "PCM24"
731-
else:
732-
if file_format == "s8":
733-
return 8
734-
elif file_format == "s16le":
735-
return 16
736-
else:
737-
return 24
765+
rx_map = {
766+
"s8": "PCM8",
767+
"u8": "PCM8",
768+
"s16le": "PCM16",
769+
"s16be": "PCM16",
770+
"s24le": "PCM24",
771+
"s24be": "PCM24",
772+
}
773+
return rx_map.get(fmt, "PCM24")
774+
775+
tx_map = {
776+
"s8": 8,
777+
"u8": 8,
778+
"s16le": 16,
779+
"s16be": 16,
780+
"s24le": 24,
781+
"s24be": 24,
782+
}
783+
return tx_map.get(fmt, 24)
738784

739785

740786
def get_case_id() -> str:

tests/validation/tests/dual/gstreamer/video_resolution/test_video_resolution_dual.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@ def test_video_resolutions_dual(
2424
prepare_ramdisk,
2525
):
2626
"""Test GStreamer ST20P video resolution in dual host configuration."""
27-
video_file = yuv_files[file]
28-
video_file["format"] = "v210"
27+
video_file = yuv_files[file].copy()
28+
29+
gst_format = (
30+
"v210"
31+
if video_file["width"] % 6 == 0
32+
else GstreamerApp.video_format_change(video_file["format"])
33+
)
2934

3035
# Get TX and RX hosts
3136
host_list = list(hosts.values())
@@ -35,18 +40,19 @@ def test_video_resolutions_dual(
3540
tx_host = host_list[0]
3641
rx_host = host_list[1]
3742

38-
SDBQ1971_conversion_v210_720p_error(
39-
video_format=video_file["format"],
40-
resolution_width=video_file["height"],
41-
request=request,
42-
)
43+
if gst_format == "v210":
44+
SDBQ1971_conversion_v210_720p_error(
45+
video_format=gst_format,
46+
resolution_height=video_file["height"],
47+
request=request,
48+
)
4349

4450
# Create input file on TX host
4551
input_file_path = media_create.create_video_file(
4652
width=video_file["width"],
4753
height=video_file["height"],
4854
framerate=video_file["fps"],
49-
format=GstreamerApp.video_format_change(video_file["format"]),
55+
format=gst_format,
5056
media_path=media,
5157
duration=2,
5258
host=tx_host,
@@ -63,7 +69,7 @@ def test_video_resolutions_dual(
6369
width=video_file["width"],
6470
height=video_file["height"],
6571
framerate=video_file["fps"],
66-
format=GstreamerApp.video_format_change(video_file["format"]),
72+
format=gst_format,
6773
tx_payload_type=112,
6874
tx_queues=4,
6975
)
@@ -76,7 +82,7 @@ def test_video_resolutions_dual(
7682
width=video_file["width"],
7783
height=video_file["height"],
7884
framerate=video_file["fps"],
79-
format=GstreamerApp.video_format_change(video_file["format"]),
85+
format=gst_format,
8086
rx_payload_type=112,
8187
rx_queues=4,
8288
)

tests/validation/tests/single/gstreamer/video_resolution/test_video_resolution.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,35 @@ def test_video_resolutions(
2424
test_config,
2525
prepare_ramdisk,
2626
):
27-
video_file = yuv_files[file]
28-
video_file["format"] = "v210"
27+
video_file = yuv_files[file].copy()
28+
29+
# The st20 plugin can only produce v210 when the width is divisible by 6
30+
# (pixel groups are 6 pixels wide). Fall back to I422_10LE otherwise so
31+
# 1280-wide sources succeed instead of tripping the converter.
32+
gst_format = (
33+
"v210"
34+
if video_file["width"] % 6 == 0
35+
else GstreamerApp.video_format_change(video_file["format"])
36+
)
2937

3038
# Get the first host for remote execution
3139
host = list(hosts.values())[0]
3240
interfaces_list = setup_interfaces.get_interfaces_list_single(
3341
test_config.get("interface_type", "VF")
3442
)
3543

36-
SDBQ1971_conversion_v210_720p_error(
37-
video_format=video_file["format"],
38-
resolution_width=video_file["height"],
39-
request=request,
40-
)
44+
if gst_format == "v210":
45+
SDBQ1971_conversion_v210_720p_error(
46+
video_format=gst_format,
47+
resolution_height=video_file["height"],
48+
request=request,
49+
)
4150

4251
input_file_path = media_create.create_video_file(
4352
width=video_file["width"],
4453
height=video_file["height"],
4554
framerate=video_file["fps"],
46-
format=GstreamerApp.video_format_change(video_file["format"]),
55+
format=gst_format,
4756
media_path=media,
4857
duration=3,
4958
host=host,
@@ -56,7 +65,7 @@ def test_video_resolutions(
5665
width=video_file["width"],
5766
height=video_file["height"],
5867
framerate=video_file["fps"],
59-
format=GstreamerApp.video_format_change(video_file["format"]),
68+
format=gst_format,
6069
tx_payload_type=112,
6170
tx_queues=4,
6271
)
@@ -68,7 +77,7 @@ def test_video_resolutions(
6877
width=video_file["width"],
6978
height=video_file["height"],
7079
framerate=video_file["fps"],
71-
format=GstreamerApp.video_format_change(video_file["format"]),
80+
format=gst_format,
7281
rx_payload_type=112,
7382
rx_queues=4,
7483
)

tests/validation/tests/xfail.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def SDBQ1002_pg_format_error_check(video_format: str, pg_format: str, request):
2929

3030

3131
def SDBQ1971_conversion_v210_720p_error(
32-
video_format: str, resolution_width: int, request
32+
video_format: str, resolution_height: int, request
3333
):
34-
if video_format == "v210" and resolution_width == 720:
34+
if video_format == "v210" and resolution_height == 720:
3535
add_issue(
3636
"XFAIL: SDBQ-1971 - Conversion from v210 format does not work on 720p",
3737
request,

0 commit comments

Comments
 (0)