Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

test: require the sample-table fast path on a stream without reordering

Yoav Levavi2b796e285fa5
diff --git a/crates/video-decode/src/avassetreader.rs b/crates/video-decode/src/avassetreader.rs
index e9e2cd237..7edbf3bd4 100644
--- a/crates/video-decode/src/avassetreader.rs
+++ b/crates/video-decode/src/avassetreader.rs
@@ -589,6 +589,26 @@ mod tests {
Some((indexed, scanned))
}
+ #[test]
+ fn streams_without_reordering_read_keyframes_from_the_sample_table() {
+ let fixture =
+ Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/h264-no-reordering.mp4");
+ let (indexed, scanned) = both_indexes(&fixture).unwrap();
+ let indexed = indexed.expect("a stream without reordering should use the sample table");
+ assert_eq!(indexed, scanned);
+ assert_eq!(
+ indexed,
+ vec![
+ (0, 0.0),
+ (15, 0.5),
+ (30, 1.0),
+ (45, 1.5),
+ (60, 2.0),
+ (75, 2.5)
+ ]
+ );
+ }
+
#[test]
fn streams_with_reordering_fall_back_to_a_packet_scan() {
let fixture =
diff --git a/crates/video-decode/tests/fixtures/h264-no-reordering.mp4 b/crates/video-decode/tests/fixtures/h264-no-reordering.mp4
new file mode 100644
index 000000000..4fee6e650
Binary files /dev/null and b/crates/video-decode/tests/fixtures/h264-no-reordering.mp4 differ