raop: Discard data upon getting EAGAIN on a socket

This patch discards audio data when a socket returns EAGAIN.
This was made based on a suggestion by karlstav
(https://github.com/karlstav), and is supposed to solve Issue #32.
(https://github.com/hfujita/pulseaudio-raop2/issues/32)
This commit is contained in:
Hajime Fujita 2016-11-06 12:54:24 -06:00 committed by Tanu Kaskinen
parent 3e26f2d15e
commit d7721032ea

View file

@ -471,8 +471,7 @@ static ssize_t send_udp_audio_packet(pa_raop_client *c, pa_memchunk *block, size
written = pa_write(c->udp_sfd, buffer, packet->length, NULL);
if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
pa_log_debug("Discarding UDP (audio, seq=%d) packet due to EAGAIN (%s)", c->seq, pa_cstrerror(errno));
pa_memblock_release(packet->memblock);
return (ssize_t) packet->length;
written = packet->length;
}
pa_memblock_release(packet->memblock);