mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 18:55:01 +02:00
allow AIM event processing during repeated injection
This commit is contained in:
parent
c91f8c7685
commit
8d17df338b
1 changed files with 13 additions and 2 deletions
|
@ -79,6 +79,11 @@ void AudioInjectorManager::run() {
|
|||
if (_injectors.size() > 0) {
|
||||
// loop through the injectors in the map and send whatever frames need to go out
|
||||
auto front = _injectors.top();
|
||||
|
||||
// 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
|
||||
InjectorQueue holdingQueue;
|
||||
|
||||
while (_injectors.size() > 0 && front.first <= usecTimestampNow()) {
|
||||
// either way we're popping this injector off - get a copy first
|
||||
auto injector = front.second;
|
||||
|
@ -89,8 +94,8 @@ void AudioInjectorManager::run() {
|
|||
auto nextCallDelta = injector->injectNextFrame();
|
||||
|
||||
if (nextCallDelta >= 0 && !injector->isFinished()) {
|
||||
// re-enqueue the injector with the correct timing
|
||||
_injectors.emplace(usecTimestampNow() + nextCallDelta, injector);
|
||||
// enqueue the injector with the correct timing in our holding queue
|
||||
holdingQueue.emplace(usecTimestampNow() + nextCallDelta, injector);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,6 +106,12 @@ void AudioInjectorManager::run() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if there are injectors in the holding queue, push them to our persistent queue now
|
||||
while (!holdingQueue.empty()) {
|
||||
_injectors.push(holdingQueue.top());
|
||||
holdingQueue.pop();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue