From 3be336afa80d2fc792287d2abf71879140f5b143 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Sun, 25 Sep 2022 07:45:25 -0600 Subject: [PATCH] Handle case where hwaccel is not setup --- frigate/stats.py | 7 +++-- web/src/routes/System.jsx | 54 ++++++++++++++++++++++----------------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/frigate/stats.py b/frigate/stats.py index e39d47ba0..48ea9f30b 100644 --- a/frigate/stats.py +++ b/frigate/stats.py @@ -86,10 +86,13 @@ def get_temperatures() -> dict[str, float]: def get_gpu_stats(config: FrigateConfig) -> dict[str, dict]: """Parse GPUs from hwaccel args and use for stats.""" hwaccel_args = set( - map(lambda camera: camera.ffmpeg.hwaccel_args, config.cameras.values()) - ) + map(lambda camera: camera.ffmpeg.hwaccel_args if camera.ffmpeg.hwaccel_args else None, config.cameras.values()) + ).remove(None) stats: dict[str, dict] = {} + if not hwaccel_args: + return None + for args in hwaccel_args: if "cuvid" in args: # nvidia GPU diff --git a/web/src/routes/System.jsx b/web/src/routes/System.jsx index 905fb14e0..7ea5fe201 100644 --- a/web/src/routes/System.jsx +++ b/web/src/routes/System.jsx @@ -134,29 +134,37 @@ export default function System() { GPUs -
- {gpuNames.map((gpu) => ( -
- - - - - - - - - - - - - -
Gpu %Memory %
{gpu_usages[gpu]['gpu']}{gpu_usages[gpu]['memory']}
-
- ))} -
+ {!gpu_usages ? ( +
+ + Hardware acceleration has not been setup, see the docs to setup hardware acceleration. + +
+ ) : ( +
+ {gpuNames.map((gpu) => ( +
+ + + + + + + + + + + + + +
Gpu %Memory %
{gpu_usages[gpu]['gpu']}{gpu_usages[gpu]['memory']}
+
+ ))} +
+ )} Cameras