Expose desktop output latency and verify hardware clock transitions
This commit is contained in:
1 parent
3083cc05dc
commit
e1bb12d16a
3 files changed
+38
-3
No files matched your search
@@ -53,6 +53,30 @@ static void test_mix() {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CALL, "PASS timeline: weighted overlap, input boundary, source discontinuity");
|
||||
}
|
||||
|
||||
static void test_hardware_anchor_transition() {
|
||||
CallTimeline map;
|
||||
map.reset(1);
|
||||
for (unsigned i = 0; i < 20; ++i) {
|
||||
map.feed(1000000 + i * 20000, 960, 1);
|
||||
map.source({SourceKind::Copy, SourceError::None, i * 960, i * 960, 0, 960});
|
||||
map.read(960);
|
||||
}
|
||||
map.progress(1, 9600, 1020000, 1000000, false);
|
||||
auto before = map.clock(1000000);
|
||||
CHECK(before.valid && before.played_samples == 8640 && !before.measured);
|
||||
// Новая аппаратная метка обнаружила ещё 100мс HAL: не регрессируем позицию, ждём реальный звук.
|
||||
map.progress(1, 10560, 1140000, 1020000, true);
|
||||
auto after = map.clock(1020000);
|
||||
CHECK(after.valid && after.measured && after.pts_us == before.pts_us);
|
||||
CHECK(map.clock(1100000).pts_us == before.pts_us);
|
||||
CHECK(map.clock(1120000).pts_us > before.pts_us);
|
||||
CHECK(!map.clock(1300000).valid);
|
||||
// После смены выхода позиция написанного PCM продолжается, меняется лишь физический срок.
|
||||
map.progress(1, 19200, 1320000, 1300000, true);
|
||||
CHECK(map.clock(1300000).valid && map.clock(1300000).pts_us >= after.pts_us);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CALL, "PASS timeline: hardware timestamp acquisition, route change, no clock regression");
|
||||
}
|
||||
|
||||
static void test_long_run() {
|
||||
CallTimeline map;
|
||||
map.reset(1);
|
||||
@@ -108,6 +132,6 @@ static void test_failure_and_recovery() {
|
||||
|
||||
int main() {
|
||||
debug_config_init(); debug_set_level(DEBUG_LEVEL_INFO);
|
||||
test_boundaries(); test_mix(); test_long_run(); test_failure_and_recovery();
|
||||
test_boundaries(); test_mix(); test_hardware_anchor_transition(); test_long_run(); test_failure_and_recovery();
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user