fix: GPS缺失下的数据缺失问题
This commit is contained in:
@@ -103,13 +103,17 @@ class VideoDisplayProbeStore:
|
||||
@dataclass(frozen=True)
|
||||
class FrameTrailerMetadata:
|
||||
timestamp_ns: int
|
||||
latitude: float
|
||||
longitude: float
|
||||
latitude: float | None
|
||||
longitude: float | None
|
||||
capture_to_send_ms: int
|
||||
raw_latitude_hex: str
|
||||
raw_longitude_hex: str
|
||||
received_at: float
|
||||
|
||||
@property
|
||||
def has_gps_fix(self) -> bool:
|
||||
return self.latitude is not None and self.longitude is not None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class VideoDisplayProbeStatus:
|
||||
@@ -271,21 +275,23 @@ class OmniSocketVideoReceiver:
|
||||
|
||||
if timestamp_ms <= 0:
|
||||
return None
|
||||
if not math.isfinite(latitude) or not math.isfinite(longitude):
|
||||
return None
|
||||
if not (-90.0 <= latitude <= 90.0) or not (-180.0 <= longitude <= 180.0):
|
||||
return None
|
||||
if abs(latitude) < 1e-9 and abs(longitude) < 1e-9:
|
||||
return None
|
||||
|
||||
timestamp_ns = timestamp_ms * VIDEO_TRAILER_TIMESTAMP_MULTIPLIER_NS
|
||||
if abs(time.time_ns() - timestamp_ns) > VIDEO_TRAILER_TIMESTAMP_MAX_SKEW_NS:
|
||||
return None
|
||||
|
||||
gps_fix_available = (
|
||||
math.isfinite(latitude)
|
||||
and math.isfinite(longitude)
|
||||
and (-90.0 <= latitude <= 90.0)
|
||||
and (-180.0 <= longitude <= 180.0)
|
||||
and not (abs(latitude) < 1e-9 and abs(longitude) < 1e-9)
|
||||
)
|
||||
|
||||
return FrameTrailerMetadata(
|
||||
timestamp_ns=timestamp_ns,
|
||||
latitude=latitude,
|
||||
longitude=longitude,
|
||||
latitude=latitude if gps_fix_available else None,
|
||||
longitude=longitude if gps_fix_available else None,
|
||||
capture_to_send_ms=int(capture_to_send_ms),
|
||||
raw_latitude_hex=trailer[8:16].hex(),
|
||||
raw_longitude_hex=trailer[16:24].hex(),
|
||||
|
||||
Reference in New Issue
Block a user