Codebase list squeezelite / dc17e28
protect against high cpu with alsa null output Adrian Smith 10 years ago
2 changed file(s) with 9 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
240240
241241 wrote = output.write_cb(out_frames, silence, gainL, gainR, cross_gain_in, cross_gain_out, &cross_ptr);
242242
243 if (wrote < 0) {
244 LOG_WARN("error in write cb");
245 frames -= out_frames;
243 if (wrote <= 0) {
244 frames -= size;
246245 break;
247246 } else {
248247 out_frames = (frames_t)wrote;
588588 }
589589
590590 // 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 }
592598
593599 UNLOCK;
594600 }