@@ -227,7 +227,6 @@ def allocate(self, length: int):
227227 self .handle = alloc .handle
228228 self .mmap_len = alloc .len
229229
230-
231230 fd_data = ion_fd_data ()
232231 fd_data .handle = self .handle
233232 if ctypes .pythonapi .ioctl (self .ion_fd , ION_IOC_SHARE , ctypes .byref (fd_data )) != 0 :
@@ -237,11 +236,9 @@ def allocate(self, length: int):
237236 self ._mmap = mmap .mmap (self .fd , self .mmap_len )
238237 self .addr = ctypes .addressof (ctypes .c_char .from_buffer (self ._mmap ))
239238
240-
241239 ctypes .memset (self .addr , 0 , self .mmap_len )
242240 return
243241
244-
245242 base_dir = "/dev/shm" if platform .system () != "Darwin" else "/tmp"
246243 self .mmap_len = self .len + 8
247244 name = f"{ base_dir } /visionbuf_{ os .getpid ()} _{ id (self )} "
@@ -405,7 +402,6 @@ def create_buffers_with_sizes(self, stream: VisionStreamType, num_buffers: int,
405402 self .buffers [stream ] = bufs
406403 self .cur_idx [stream ] = 0
407404
408-
409405 ctx = msgq .Context ()
410406 sock = msgq .PubSocket ()
411407 sock .connect (ctx , get_endpoint_name (self .name , stream ))
@@ -437,7 +433,6 @@ def send(
437433 ctypes .memmove (buf .addr , data .ctypes .data , min (data .nbytes , buf .len ))
438434 extra_valid = True
439435
440-
441436 buf .sync (False )
442437
443438 packet = VisionIpcPacket ()
@@ -581,10 +576,8 @@ def connect(self, blocking: bool = True):
581576 s_sock = socket .socket (socket .AF_UNIX , sock_type )
582577 s_sock .connect (path )
583578
584-
585579 s_sock .send (struct .pack ("i" , int (self .stream )))
586580
587-
588581 iov , ancillary , flags , addr = s_sock .recvmsg (8192 , 4096 )
589582 s_sock .close ()
590583
@@ -600,7 +593,6 @@ def connect(self, blocking: bool = True):
600593 continue
601594 return False
602595
603-
604596 self .buffers = []
605597 for i in range (num_buffers ):
606598 width , height , stride , uv_offset , length = struct .unpack_from ("QQQQQ" , iov , i * 40 )
@@ -643,13 +635,11 @@ def recv(self, timeout_ms: int = 100) -> Optional[VisionBuf]:
643635 if not msg :
644636 return None
645637
646-
647638 if len (msg ) < ctypes .sizeof (VisionIpcPacket ):
648639 return None
649640
650641 packet = VisionIpcPacket .from_buffer_copy (msg )
651642
652-
653643 self .frame_id = packet .extra .frame_id
654644 self .timestamp_sof = packet .extra .timestamp_sof
655645 self .timestamp_eof = packet .extra .timestamp_eof
@@ -670,7 +660,6 @@ def recv(self, timeout_ms: int = 100) -> Optional[VisionBuf]:
670660
671661 return cast (VisionBuf , buf )
672662
673-
674663 @staticmethod
675664 def available_streams (name : str , blocking : bool = True ) -> Set [VisionStreamType ]:
676665 path = get_ipc_path (name )
0 commit comments