Suspend hardware clock during output replacement without resetting media

This commit is contained in:
evgeny committed 2026-10-15 14:36:03 +02:00
1 parent ede911e7e4
commit 0a56c01e29
3 files changed
+31 -2

No files matched your search

+20 -1
View File
@@ -130,8 +130,27 @@ static void test_failure_and_recovery() {
DEBUG_INFO(DEBUG_CATEGORY_CALL, "PASS timeline: regressing/impossible device head, overread, bounded overflow, reset recovery");
}
static void test_device_reopen() {
CallTimeline map;
map.reset(7); map.feed(1000000, 1920, 1);
map.source({SourceKind::Copy, SourceError::None, 0, 0, 0, 1920}); map.read(1920);
map.progress(7, 960, 30000, 10000, true);
auto before = map.clock(20000); CHECK(before.valid);
map.suspend_device(6); CHECK(map.clock(20000).valid);
map.suspend_device(7); CHECK(!map.clock(20001).valid);
CHECK(map.clock(20001).written_samples == 1920);
map.progress(7, 1920, 70000, 50000, true);
auto after = map.clock(50000);
CHECK(after.valid && after.epoch == 7 && after.pts_us >= before.pts_us);
CHECK(after.played_samples == 960);
map.suspend_device(7);
map.progress(7, 1000, 80000, 60000, true); // Пересоздание не разрешает регрессию общей позиции.
CHECK(!map.clock(60000).valid);
DEBUG_INFO(DEBUG_CATEGORY_CALL, "PASS timeline: device reopen preserves PCM/epoch and rejects old/regressing anchors");
}
int main() {
debug_config_init(); debug_set_level(DEBUG_LEVEL_INFO);
test_boundaries(); test_mix(); test_hardware_anchor_transition(); test_long_run(); test_failure_and_recovery();
test_boundaries(); test_mix(); test_hardware_anchor_transition(); test_long_run(); test_failure_and_recovery(); test_device_reopen();
return 0;
}