- switch (errno) {
- case EINTR:
- continue;
- case EAGAIN:
- /* If the buffer_size is too big, we get EAGAIN. Avoiding that limit by trial and error
- * is not ideal, but I don't know how to get the system to tell me what the limit is.
- */
- u->buffer_size = u->buffer_size * 18 / 25;
- u->buffer_size -= u->buffer_size % u->frame_size;
- u->buffer_size = PA_MAX(u->buffer_size, 2 * u->minimum_request);
- pa_sink_set_max_request_within_thread(u->sink, u->buffer_size);
- pa_sink_set_max_rewind_within_thread(u->sink, u->buffer_size);
- pa_log("EAGAIN. Buffer size is now %u bytes (%llu buffered)", u->buffer_size, buffered_bytes);
- break;
- default:
- pa_log("Failed to write data to DSP: %s", pa_cstrerror(errno));
- goto fail;
+ if (errno == EINTR) {
+ continue;
+ } else if (errno == EAGAIN) {
+ /* We may have realtime priority so yield the CPU to ensure that fd can become writable again. */
+ pa_log_debug("EAGAIN with %llu bytes buffered.", buffered_bytes);
+ break;
+ } else {
+ pa_log("Failed to write data to DSP: %s", pa_cstrerror(errno));
+ goto fail;