ALSA: prevent excessive slave-device latency updates on underrun
This commit is contained in:
parent
fd33784e45
commit
96c138c985
@ -2222,19 +2222,34 @@ AlsaAudioBackend::AudioSlave::update_latencies (uint32_t play, uint32_t capt)
|
|||||||
{
|
{
|
||||||
LatencyRange lr;
|
LatencyRange lr;
|
||||||
lr.min = lr.max = (capt);
|
lr.min = lr.max = (capt);
|
||||||
|
bool changed = false;
|
||||||
for (std::vector<BackendPortPtr>::const_iterator it = inputs.begin (); it != inputs.end (); ++it) {
|
for (std::vector<BackendPortPtr>::const_iterator it = inputs.begin (); it != inputs.end (); ++it) {
|
||||||
|
LatencyRange lx;
|
||||||
|
lx = (*it)->latency_range (false);
|
||||||
|
if (lr == lx) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
(*it)->set_latency_range (lr, false);
|
(*it)->set_latency_range (lr, false);
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
lr.min = lr.max = play;
|
lr.min = lr.max = play;
|
||||||
for (std::vector<BackendPortPtr>::const_iterator it = outputs.begin (); it != outputs.end (); ++it) {
|
for (std::vector<BackendPortPtr>::const_iterator it = outputs.begin (); it != outputs.end (); ++it) {
|
||||||
|
LatencyRange lx;
|
||||||
|
lx = (*it)->latency_range (true);
|
||||||
|
if (lr == lx) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
(*it)->set_latency_range (lr, true);
|
(*it)->set_latency_range (lr, true);
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
printf ("ALSA SLAVE-device latency play=%d capt=%d\n", play, capt); // XXX DEBUG
|
printf ("ALSA SLAVE-device latency play=%d capt=%d changed:%d\n", play, capt, changed); // XXX DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
if (changed) {
|
||||||
UpdateLatency (); /* EMIT SIGNAL */
|
UpdateLatency (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user