mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 08:14:00 +08:00
loggerd: trigger rotate on frame id instead of frame count (#22848)
Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: ea761cbbd5103a589915ec3766b4d6056293cba6
This commit is contained in:
@@ -97,10 +97,8 @@ class TestEncoder(unittest.TestCase):
|
||||
|
||||
file_path = f"{route_prefix_path}--{i}/{camera}"
|
||||
|
||||
# check file size
|
||||
self.assertTrue(os.path.exists(file_path))
|
||||
file_size = os.path.getsize(file_path)
|
||||
self.assertTrue(math.isclose(file_size, size, rel_tol=FILE_SIZE_TOLERANCE))
|
||||
# check file exists
|
||||
self.assertTrue(os.path.exists(file_path), f"segment #{i}: '{file_path}' missing")
|
||||
|
||||
# TODO: this ffprobe call is really slow
|
||||
# check frame count
|
||||
@@ -116,7 +114,11 @@ class TestEncoder(unittest.TestCase):
|
||||
counts.append(frame_count)
|
||||
|
||||
self.assertTrue(abs(expected_frames - frame_count) <= frame_tolerance,
|
||||
f"{camera} failed frame count check: expected {expected_frames}, got {frame_count}")
|
||||
f"segment #{i}: {camera} failed frame count check: expected {expected_frames}, got {frame_count}")
|
||||
|
||||
# sanity check file size
|
||||
file_size = os.path.getsize(file_path)
|
||||
self.assertTrue(math.isclose(file_size, size, rel_tol=FILE_SIZE_TOLERANCE))
|
||||
|
||||
# Check encodeIdx
|
||||
if encode_idx_name is not None:
|
||||
@@ -151,15 +153,16 @@ class TestEncoder(unittest.TestCase):
|
||||
self.assertEqual(min(counts), expected_frames)
|
||||
shutil.rmtree(f"{route_prefix_path}--{i}")
|
||||
|
||||
for i in trange(num_segments + 1):
|
||||
# poll for next segment
|
||||
with Timeout(int(SEGMENT_LENGTH*10), error_msg=f"timed out waiting for segment {i}"):
|
||||
while Path(f"{route_prefix_path}--{i}") not in Path(ROOT).iterdir():
|
||||
time.sleep(0.1)
|
||||
|
||||
managed_processes['loggerd'].stop()
|
||||
managed_processes['camerad'].stop()
|
||||
managed_processes['sensord'].stop()
|
||||
try:
|
||||
for i in trange(num_segments + 1):
|
||||
# poll for next segment
|
||||
with Timeout(int(SEGMENT_LENGTH*10), error_msg=f"timed out waiting for segment {i}"):
|
||||
while Path(f"{route_prefix_path}--{i}") not in Path(ROOT).iterdir():
|
||||
time.sleep(0.1)
|
||||
finally:
|
||||
managed_processes['loggerd'].stop()
|
||||
managed_processes['camerad'].stop()
|
||||
managed_processes['sensord'].stop()
|
||||
|
||||
for i in trange(num_segments):
|
||||
check_seg(i)
|
||||
|
||||
Reference in New Issue
Block a user