* Use list for zones to keep chronological order

* Replace when changing playbackRate
This commit is contained in:
Nicolas Mowen 2024-06-25 06:38:37 -06:00 committed by GitHub
parent c3455518c2
commit bfbacee7b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 8 deletions

View File

@ -53,7 +53,7 @@ class PendingReviewSegment:
severity: SeverityEnum,
detections: dict[str, str],
sub_labels: set[str],
zones: set[str],
zones: list[str],
audio: set[str],
):
rand_id = "".join(random.choices(string.ascii_lowercase + string.digits, k=6))
@ -137,7 +137,7 @@ class PendingReviewSegment:
"detections": list(set(self.detections.keys())),
"objects": list(set(self.detections.values())),
"sub_labels": list(self.sub_labels),
"zones": list(self.zones),
"zones": self.zones,
"audio": list(self.audio),
},
}.copy()
@ -279,7 +279,9 @@ class ReviewSegmentMaintainer(threading.Thread):
# keep zones up to date
if len(object["current_zones"]) > 0:
segment.zones.update(object["current_zones"])
for zone in object["current_zones"]:
if zone not in segment.zones:
segment.zones.append(zone)
if len(active_objects) > segment.frame_active_count:
should_update = True
@ -329,7 +331,7 @@ class ReviewSegmentMaintainer(threading.Thread):
if len(active_objects) > 0:
detections: dict[str, str] = {}
sub_labels = set()
zones: set = set()
zones: list[str] = []
severity = None
for object in active_objects:
@ -379,7 +381,9 @@ class ReviewSegmentMaintainer(threading.Thread):
):
severity = SeverityEnum.detection
zones.update(object["current_zones"])
for zone in object["current_zones"]:
if zone not in zones:
zones.append(zone)
if severity:
self.active_review_segments[camera] = PendingReviewSegment(
@ -534,7 +538,7 @@ class ReviewSegmentMaintainer(threading.Thread):
severity,
{},
set(),
set(),
[],
detections,
)
elif topic == DetectionTypeEnum.api:
@ -544,7 +548,7 @@ class ReviewSegmentMaintainer(threading.Thread):
SeverityEnum.alert,
{manual_info["event_id"]: manual_info["label"]},
set(),
set(),
[],
set(),
)

View File

@ -202,7 +202,7 @@ export default function HlsVideoPlayer({
videoRef.current.currentTime = Math.max(0, currentTime + diff);
}}
onSetPlaybackRate={(rate) => {
setPlaybackRate(rate);
setPlaybackRate(rate, true);
if (videoRef.current) {
videoRef.current.playbackRate = rate;