mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-11 13:30:02 -05:00
raop: fix sequence number overflow
Wrap sequence number when we reach uint16_t's max 0xFFFF.
This commit is contained in:
parent
81fa11e3a9
commit
b95aebdb2d
3 changed files with 29 additions and 3 deletions
|
|
@ -316,7 +316,12 @@ static size_t build_tcp_audio_packet(pa_raop_client *c, pa_memchunk *block, pa_m
|
|||
buffer += packet->index / sizeof(uint32_t);
|
||||
raw += block->index;
|
||||
|
||||
c->seq++;
|
||||
if (c->seq == 0xFFFF) {
|
||||
pa_log_debug("wrapping sequence number");
|
||||
c->seq = pa_raop_packet_buffer_wrap_seq(c->pbuf, c->seq);
|
||||
} else
|
||||
c->seq++;
|
||||
|
||||
memcpy(buffer, tcp_audio_header, sizeof(tcp_audio_header));
|
||||
buffer[1] |= htonl((uint32_t) c->seq);
|
||||
buffer[2] = htonl(c->rtptime);
|
||||
|
|
@ -421,7 +426,12 @@ static size_t build_udp_audio_packet(pa_raop_client *c, pa_memchunk *block, pa_m
|
|||
}
|
||||
|
||||
c->rtptime += length / 4;
|
||||
c->seq++;
|
||||
|
||||
if (c->seq == 0xFFFF) {
|
||||
pa_log_debug("wrapping sequence number");
|
||||
c->seq = pa_raop_packet_buffer_wrap_seq(c->pbuf, c->seq);
|
||||
} else
|
||||
c->seq++;
|
||||
|
||||
pa_memblock_release(block->memblock);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue