Catch case where recording starts right at end of request (#12956)

This commit is contained in:
Nicolas Mowen 2024-08-11 07:32:17 -06:00 committed by GitHub
parent 67ba3dbd8b
commit 13d121f443
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -546,6 +546,11 @@ def vod_ts(camera_name, start_ts, end_ts):
if recording.end_time > end_ts: if recording.end_time > end_ts:
duration -= int((recording.end_time - end_ts) * 1000) duration -= int((recording.end_time - end_ts) * 1000)
if duration == 0:
# this means the segment starts right at the end of the requested time range
# and it does not need to be included
continue
if 0 < duration < max_duration_ms: if 0 < duration < max_duration_ms:
clip["keyFrameDurations"] = [duration] clip["keyFrameDurations"] = [duration]
clips.append(clip) clips.append(clip)