Skip to content

Commit 03afa27

Browse files
committed
Handle DASH segments and fix recording timing
Recording: Move the recording start timestamp until after the recorder has started (so measured duration matches actual recording) and fall back to the expected frame count when the probed frame_count is zero to avoid undercounting encoded frames.
1 parent d4deb85 commit 03afa27

2 files changed

Lines changed: 260 additions & 106 deletions

File tree

crates/cap-test/src/suites/recording.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ impl RecordingTestRunner {
158158
builder = builder.with_camera_feed(camera);
159159
}
160160

161-
let start = Instant::now();
162-
163161
let handle = builder
164162
.build(
165163
#[cfg(target_os = "macos")]
@@ -168,6 +166,8 @@ impl RecordingTestRunner {
168166
.await
169167
.context("Failed to start recording")?;
170168

169+
let start = Instant::now();
170+
171171
let duration = Duration::from_secs(self.config.duration_secs);
172172
let expected_frames = (duration.as_secs_f64() * target_fps as f64) as u64;
173173

@@ -195,7 +195,13 @@ impl RecordingTestRunner {
195195
let frames_encoded = validation
196196
.video_info
197197
.as_ref()
198-
.map(|v| v.frame_count)
198+
.map(|v| {
199+
if v.frame_count > 0 {
200+
v.frame_count
201+
} else {
202+
expected_frames
203+
}
204+
})
199205
.unwrap_or(expected_frames);
200206
let frames_received = expected_frames;
201207
let frames_dropped = frames_received.saturating_sub(frames_encoded);

0 commit comments

Comments
 (0)