MT#40962 replace usleep with waitForEventTimed

Change-Id: I3dfdcd70d7f33f377bcdd76e72854525070c09ab
mr12.3.1
Richard Fuchs 2 years ago
parent b733d3ce25
commit 38cc845923

@ -250,15 +250,21 @@ void AmMediaProcessorThread::run()
uint64_t diff = next_tick - now;
if(diff)
usleep(diff);
events.waitForEventTimed(diff / 1000);
}
processAudio(ts);
events.processEvents();
processDtmfEvents();
ts = (ts + WC_INC) & WALLCLOCK_MASK;
next_tick += tick;
// recheck time as we may have been woken up too soon
now = gettimeofday_us();
if (now >= next_tick) {
processAudio(ts);
processDtmfEvents();
ts = (ts + WC_INC) & WALLCLOCK_MASK;
next_tick += tick;
}
}
}

Loading…
Cancel
Save