player: disable mppvideodec auto-rank-boost, add R36S_HW_DECODE=1 opt-in
mppvideodec outputs NV12 (hardware format) which GStreamer videoconvert converts to BGRA in scalar software code — slower than avdec_h264 which uses libav's NEON-optimised YUV→BGRA path. Default behaviour: software decode (avdec_h264) at PRIMARY rank. The MPP plugin is still detected and logged so the user knows it is installed and operational. Set R36S_HW_DECODE=1 to re-enable the rank boost once a zero-copy NV12→SDL_UpdateNVTexture (or similar) upload path is implemented.
This commit is contained in:
@@ -60,15 +60,35 @@ def _vpu_device_accessible() -> bool:
|
|||||||
|
|
||||||
def _probe_hw_decoders(gst_module) -> list:
|
def _probe_hw_decoders(gst_module) -> list:
|
||||||
"""
|
"""
|
||||||
Probe for available hardware video decoder GStreamer elements and boost
|
Probe for available hardware video decoder GStreamer elements.
|
||||||
their rank so that playbin's internal decodebin prefers them over software
|
|
||||||
decoders. Returns the list of element names that were found and boosted.
|
Hardware decode (mppvideodec / V4L2) is only auto-selected when
|
||||||
If no VPU device node is accessible the probe is skipped entirely so that
|
R36S_HW_DECODE=1 is set in the environment. By default the probe is a
|
||||||
a half-initialised hardware element cannot stall the pipeline.
|
no-op: software avdec_h264 (libav, NEON-optimised) remains preferred
|
||||||
|
because mppvideodec outputs NV12 which requires an additional software
|
||||||
|
NV12→BGRA conversion step that outweighs the decode speedup.
|
||||||
|
|
||||||
|
Set R36S_HW_DECODE=1 (e.g. in MatHacks.sh) once a zero-copy NV12 SDL
|
||||||
|
texture upload path is implemented.
|
||||||
|
|
||||||
|
Returns the list of element names whose rank was boosted.
|
||||||
"""
|
"""
|
||||||
|
if os.environ.get("R36S_HW_DECODE", "0") != "1":
|
||||||
|
# Still probe and log availability so the user knows the plugin is
|
||||||
|
# installed, but do not boost rank.
|
||||||
|
if _vpu_device_accessible():
|
||||||
|
for name in _HW_DECODER_ELEMENTS:
|
||||||
|
if gst_module.ElementFactory.find(name) is not None:
|
||||||
|
log.info(
|
||||||
|
"HW decode: %s available (VPU accessible) — not auto-selected. "
|
||||||
|
"Set R36S_HW_DECODE=1 to enable (experimental).", name
|
||||||
|
)
|
||||||
|
return []
|
||||||
|
|
||||||
if not _vpu_device_accessible():
|
if not _vpu_device_accessible():
|
||||||
log.info(
|
log.info(
|
||||||
"HW decode: no accessible VPU device node — using software decode. "
|
"HW decode: R36S_HW_DECODE=1 but no accessible VPU device node — "
|
||||||
|
"falling back to software decode. "
|
||||||
"Run deploy/arkos/setup_hw_decode.sh as root to fix permissions."
|
"Run deploy/arkos/setup_hw_decode.sh as root to fix permissions."
|
||||||
)
|
)
|
||||||
return []
|
return []
|
||||||
|
|||||||
Reference in New Issue
Block a user