fix(streaming): hitches in VoDs & Clips resulting from ffmpeg concatenation #44

Merged
dylan merged 7 commits from fix/hitches-in-vods into master 2026-09-16 19:49:04 +01:00
Showing only changes of commit 0e0146ebf9 - Show all commits

View File

@@ -80,8 +80,6 @@ public class StreamActionsService {
long firstMs = parseTimestampMs(segments.getFirst()); long firstMs = parseTimestampMs(segments.getFirst());
float trimOffset = Math.max(0f, (startTime.toEpochMilli() - firstMs) / 1000f); float trimOffset = Math.max(0f, (startTime.toEpochMilli() - firstMs) / 1000f);
// A first segment shorter than the trim offset means the requested start
// lands in a gap after it; drop it and begin at the next recorded footage.
if (trimOffset > 0 && probeDurationSeconds(segments.getFirst()) < trimOffset) { if (trimOffset > 0 && probeDurationSeconds(segments.getFirst()) < trimOffset) {
segments.removeFirst(); segments.removeFirst();
if (segments.isEmpty()) { if (segments.isEmpty()) {
@@ -91,11 +89,8 @@ public class StreamActionsService {
trimOffset = 0f; trimOffset = 0f;
} }
// Segments are copied whole, so playback begins at the first segment's
// boundary rather than at the requested start. Measure the duration from
// there so the section still ends at endTime, lead-in included.
float duration = (endTime.toEpochMilli() - firstMs) / 1000f;
float duration = (endTime.toEpochMilli() - firstMs) / 1000f;
return new SegmentSelection(segments, trimOffset, duration); return new SegmentSelection(segments, trimOffset, duration);
} }