mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-18 01:30:56 +00:00
Attempts to correct insertion logic (and mostly bypasses it).
This commit is contained in:
parent
b33218c61e
commit
c8fe66092b
@ -269,17 +269,22 @@ class Video {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!pending_events_.empty()) {
|
||||||
// Otherwise enqueue, having subtracted the delay for any preceding events,
|
// Otherwise enqueue, having subtracted the delay for any preceding events,
|
||||||
// and subtracting from the subsequent, if any.
|
// and subtracting from the subsequent, if any.
|
||||||
auto insertion_point = pending_events_.begin();
|
auto insertion_point = pending_events_.begin();
|
||||||
while(insertion_point != pending_events_.end() && insertion_point->delay > delay) {
|
while(insertion_point != pending_events_.end() && insertion_point->delay < delay) {
|
||||||
delay -= insertion_point->delay;
|
delay -= insertion_point->delay;
|
||||||
++insertion_point;
|
++insertion_point;
|
||||||
}
|
}
|
||||||
if(insertion_point != pending_events_.end()) {
|
if(insertion_point != pending_events_.end()) {
|
||||||
insertion_point->delay -= delay;
|
insertion_point->delay -= delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
pending_events_.emplace(insertion_point, type, delay);
|
pending_events_.emplace(insertion_point, type, delay);
|
||||||
|
} else {
|
||||||
|
pending_events_.emplace_back(type, delay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
friend class ::VideoTester;
|
friend class ::VideoTester;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user