From 4581f6c36812c535b3e63b258296ed920fb486e6 Mon Sep 17 00:00:00 2001 From: Andrei Radulescu Date: Tue, 11 Jun 2024 17:57:56 +0300 Subject: [PATCH] compressed_vipc.py fixes (#32699) * Restored VISION_STREAM_* to original index order * Register exit handler --- tools/camerastream/compressed_vipc.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/camerastream/compressed_vipc.py b/tools/camerastream/compressed_vipc.py index ea427816e..6c27e861f 100755 --- a/tools/camerastream/compressed_vipc.py +++ b/tools/camerastream/compressed_vipc.py @@ -6,6 +6,7 @@ import argparse import numpy as np import multiprocessing import time +import signal import cereal.messaging as messaging from msgq.visionipc import VisionIpcServer, VisionStreamType @@ -18,8 +19,8 @@ V4L2_BUF_FLAG_KEYFRAME = 8 ENCODE_SOCKETS = { VisionStreamType.VISION_STREAM_ROAD: "roadEncodeData", - VisionStreamType.VISION_STREAM_WIDE_ROAD: "wideRoadEncodeData", VisionStreamType.VISION_STREAM_DRIVER: "driverEncodeData", + VisionStreamType.VISION_STREAM_WIDE_ROAD: "wideRoadEncodeData", } def decoder(addr, vipc_server, vst, nvidia, W, H, debug=False): @@ -147,10 +148,14 @@ if __name__ == "__main__": vision_streams = [ VisionStreamType.VISION_STREAM_ROAD, - VisionStreamType.VISION_STREAM_WIDE_ROAD, VisionStreamType.VISION_STREAM_DRIVER, + VisionStreamType.VISION_STREAM_WIDE_ROAD, ] vsts = [vision_streams[int(x)] for x in args.cams.split(",")] cvipc = CompressedVipc(args.addr, vsts, args.nvidia, debug=(not args.silent)) + + # register exit handler + signal.signal(signal.SIGINT, lambda sig, frame: cvipc.kill()) + cvipc.join()