fix(node): verify D455 access and share sensor progress and recording UI
This commit is contained in:
@@ -5,6 +5,7 @@ import ipaddress
|
||||
import json
|
||||
import time
|
||||
import uuid
|
||||
from fractions import Fraction
|
||||
|
||||
import aioice.ice
|
||||
from aiortc import RTCConfiguration, RTCPeerConnection, RTCSessionDescription, VideoStreamTrack
|
||||
@@ -35,11 +36,16 @@ class CameraTrack(VideoStreamTrack):
|
||||
def __init__(self, device, layer):
|
||||
super().__init__()
|
||||
self.device, self.layer = device, layer
|
||||
self.started = None
|
||||
self.sequence = 0
|
||||
|
||||
async def recv(self):
|
||||
pts, base = await self.next_timestamp()
|
||||
# Bound preview to 15 Hz; hardware profiles and raw recording are independent.
|
||||
await asyncio.sleep(1 / 30)
|
||||
# Fixed 15 Hz preview clock; raw hardware timing is independent.
|
||||
if self.started is None:
|
||||
self.started = time.monotonic()
|
||||
await asyncio.sleep(max(0, self.started + self.sequence / 15 - time.monotonic()))
|
||||
pts, base = self.sequence * 6000, Fraction(1, 90000)
|
||||
self.sequence += 1
|
||||
while self.layer not in self.device.images:
|
||||
await asyncio.sleep(0.1)
|
||||
frame = VideoFrame.from_ndarray(self.device.images[self.layer], format="rgb24")
|
||||
|
||||
Reference in New Issue
Block a user