test: captured frames do not share memory with the SDK frame

The fake frames now hand out a buffer (memoryview) like pyrealsense2's
BufData, so np.asanyarray() of it is a view, as on the robot; a control test
proves it. Then: the captured rgb/depth share no memory with the fake SDK
frame and own their data (without the fix both shared it), and _owned()
copies views only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
OliviaCandClaude Opus 5.5 committed 2026-09-29 13:12:47 +02:00
1 parent 55e0a991b4
commit a8e380ed69
2 files changed
+47 -1

No files matched your search

+8 -1
View File
@@ -18,6 +18,11 @@ class FakeVideoFrame:
self._data = data
def get_data(self):
# A buffer over the frame's memory, as pyrealsense2's BufData: np.asanyarray() of it is a view.
return memoryview(self._data)
@property
def array(self) -> np.ndarray:
return self._data
def get_height(self) -> int:
@@ -54,6 +59,7 @@ class FakePipeline:
self._active = 0
self._lock = threading.Lock()
self.stopped = False
self.last_frameset = None
def wait_for_frames(self, timeout_ms: int = 5000):
with self._lock:
@@ -63,7 +69,8 @@ class FakePipeline:
index = self.calls
try:
time.sleep(self.latency_s)
return FakeFrameset(index)
self.last_frameset = FakeFrameset(index)
return self.last_frameset
finally:
with self._lock:
self._active -= 1