fix(quality): scale after videoconvert at exact even WxH
Live medium-quality stream errored with "negotiation problem" on the host and rendered a squashed, garbled picture in the viewer. Two causes, both from inserting videoscale before videoconvert with PAR+range caps: - videoscale was scaling pipewiresrc's raw output directly. The portal source's format/memory (e.g. DMABuf) isn't something software videoscale negotiates — the original pipeline always fed pipewiresrc through videoconvert first. Move videoscale *after* videoconvert so it operates on system-memory NV12/I420. - `pixel-aspect-ratio=1/1` + a width range over-constrained negotiation and risked a non-square-PAR / distorted result. Instead compute an exact even WxH from the known source dimensions (Wayland: portal size; X11: root/window geometry), preserving aspect, and pin it fully in the caps. This is also downscale-only now — a source already at/below the target height is left native instead of upscaled. Unknown dims (rare X11 geometry failure) fall back to the height-only + square-pixel + even width-range negotiation. source_dims threaded through pipeline::spawn from both backends. Smoke test updated to mirror the new ordering (1920x1080 -> 852x480, videoscale after videoconvert) and still asserts an even sub-source width. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -53,21 +53,22 @@ else
|
||||
fi
|
||||
|
||||
# ── quality-preset downscale check ────────────────────────────────────────
|
||||
# Mirrors the videoscale element host/pipeline.rs inserts for a non-Source
|
||||
# preset. A 16:9 source @ 480p wants width 853.3 — the danger case for H.264,
|
||||
# which needs even dimensions. Asserts videoscale negotiates an even width
|
||||
# (the pixel-aspect-ratio=1/1 + stepped-even-range caps) and the encoder
|
||||
# accepts it. Guards the "even-width caveat" the design plan flagged.
|
||||
# Mirrors the videoscale step host/pipeline.rs inserts for a non-Source preset:
|
||||
# AFTER videoconvert (scaling system-memory NV12, not the raw source format) and
|
||||
# pinned to an exact even WxH computed from the source size. A 16:9 source @
|
||||
# 480p wants width 853.3 -> 852 even. Asserts the negotiated size matches and
|
||||
# the encoder accepts it. Guards both the "even-width caveat" and the
|
||||
# negotiation/placement regression that squashed the picture.
|
||||
SCALED="${TMPDIR:-/tmp}/pixelpass-smoke-scaled-$$.ts"
|
||||
trap 'rm -f "$OUT" "$SCALED"' EXIT
|
||||
echo "[smoke] downscale check: 1920x1080 -> height 480 (videoscale, even-width)"
|
||||
echo "[smoke] downscale check: 1920x1080 -> 852x480 (videoscale after videoconvert)"
|
||||
gst-launch-1.0 -q \
|
||||
mpegtsmux name=mux ! queue ! filesink location="$SCALED" \
|
||||
videotestsrc num-buffers=30 is-live=false \
|
||||
! video/x-raw,width=1920,height=1080,framerate=30/1 \
|
||||
! videorate ! video/x-raw,framerate=30/1 \
|
||||
! videoscale ! "video/x-raw,height=480,pixel-aspect-ratio=1/1,width=[2,8192,2]" \
|
||||
! videoconvert ! video/x-raw,format=NV12 \
|
||||
! queue ! videoconvert ! video/x-raw,format=NV12 \
|
||||
! videoscale ! video/x-raw,format=NV12,width=852,height=480 \
|
||||
! vah264enc rate-control=cbr bitrate=1000 key-int-max=60 \
|
||||
! h264parse config-interval=-1 \
|
||||
! video/x-h264,stream-format=byte-stream,alignment=au ! mux. \
|
||||
|
||||
Reference in New Issue
Block a user