mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 05:22:23 +00:00
ring: use 64 bit counters
Apparently, this messes up on wraparound (although it shouldn't). After 2^32 bytes an audio "blip" happens with AOs that use this ringbuffer. Whatever, we can fix this by switching to a 64 bit counter. There's also a good chance the ringbuffer will be dropped completely, so don't waste more time on this.
This commit is contained in:
parent
c5a82f729b
commit
36fadac750
@ -30,15 +30,15 @@ struct mp_ring {
|
||||
/* Positions of the first readable/writeable chunks. Do not read this
|
||||
* fields but use the atomic private accessors `mp_ring_get_wpos`
|
||||
* and `mp_ring_get_rpos`. */
|
||||
atomic_ulong rpos, wpos;
|
||||
atomic_ullong rpos, wpos;
|
||||
};
|
||||
|
||||
static unsigned long mp_ring_get_wpos(struct mp_ring *buffer)
|
||||
static unsigned long long mp_ring_get_wpos(struct mp_ring *buffer)
|
||||
{
|
||||
return atomic_load(&buffer->wpos);
|
||||
}
|
||||
|
||||
static unsigned long mp_ring_get_rpos(struct mp_ring *buffer)
|
||||
static unsigned long long mp_ring_get_rpos(struct mp_ring *buffer)
|
||||
{
|
||||
return atomic_load(&buffer->rpos);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user