mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 06:57:37 +02:00
use a vector instead of priority queue to avoid double sort
This commit is contained in:
parent
8d17df338b
commit
20cfe80036
1 changed files with 6 additions and 5 deletions
|
@ -82,7 +82,8 @@ void AudioInjectorManager::run() {
|
||||||
|
|
||||||
// create an InjectorQueue to hold injectors to be queued
|
// create an InjectorQueue to hold injectors to be queued
|
||||||
// this allows us to call processEvents even if a single injector wants to be re-queued immediately
|
// this allows us to call processEvents even if a single injector wants to be re-queued immediately
|
||||||
InjectorQueue holdingQueue;
|
std::vector<TimeInjectorPointerPair> heldInjectors;
|
||||||
|
heldInjectors.reserve(_injectors.size());
|
||||||
|
|
||||||
while (_injectors.size() > 0 && front.first <= usecTimestampNow()) {
|
while (_injectors.size() > 0 && front.first <= usecTimestampNow()) {
|
||||||
// either way we're popping this injector off - get a copy first
|
// either way we're popping this injector off - get a copy first
|
||||||
|
@ -95,7 +96,7 @@ void AudioInjectorManager::run() {
|
||||||
|
|
||||||
if (nextCallDelta >= 0 && !injector->isFinished()) {
|
if (nextCallDelta >= 0 && !injector->isFinished()) {
|
||||||
// enqueue the injector with the correct timing in our holding queue
|
// enqueue the injector with the correct timing in our holding queue
|
||||||
holdingQueue.emplace(usecTimestampNow() + nextCallDelta, injector);
|
heldInjectors.emplace(heldInjectors.end(), usecTimestampNow() + nextCallDelta, injector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,9 +109,9 @@ void AudioInjectorManager::run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there are injectors in the holding queue, push them to our persistent queue now
|
// if there are injectors in the holding queue, push them to our persistent queue now
|
||||||
while (!holdingQueue.empty()) {
|
while (!heldInjectors.empty()) {
|
||||||
_injectors.push(holdingQueue.top());
|
_injectors.push(heldInjectors.back());
|
||||||
holdingQueue.pop();
|
heldInjectors.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue