protect against high cpu with alsa null output
Adrian Smith
10 years ago
240 | 240 |
|
241 | 241 |
wrote = output.write_cb(out_frames, silence, gainL, gainR, cross_gain_in, cross_gain_out, &cross_ptr);
|
242 | 242 |
|
243 | |
if (wrote < 0) {
|
244 | |
LOG_WARN("error in write cb");
|
245 | |
frames -= out_frames;
|
|
243 |
if (wrote <= 0) {
|
|
244 |
frames -= size;
|
246 | 245 |
break;
|
247 | 246 |
} else {
|
248 | 247 |
out_frames = (frames_t)wrote;
|
588 | 588 |
}
|
589 | 589 |
|
590 | 590 |
// process frames
|
591 | |
_output_frames(avail);
|
|
591 |
frames_t wrote = _output_frames(avail);
|
|
592 |
|
|
593 |
// some output devices such as alsa null refuse any data, avoid spinning
|
|
594 |
if (!wrote) {
|
|
595 |
LOG_SDEBUG("wrote 0 - sleeping");
|
|
596 |
usleep(10000);
|
|
597 |
}
|
592 | 598 |
|
593 | 599 |
UNLOCK;
|
594 | 600 |
}
|