summaryrefslogtreecommitdiffstats
path: root/core/mp_ring.c
Commit message (Collapse)AuthorAgeFilesLines
* core: move contents to mpvcore (1/2)Stefano Pigozzi2013-08-061-155/+0
| | | | | | | | | | core is used in many unix systems for core dumps. For that reason some tools work under the assumption that the file is indeed a core dump (for example autoconf does this). This commit just renames the files. The following one will change all the includes to fix compilation. This is done this way because git has a easier time tracing file changes if there is a pure rename commit.
* mp_ring: make mp_ring_read_cb provide an exact amount of bytesStefano Pigozzi2013-07-131-1/+1
| | | | | The previous code would pass down `len` instead of `read_len` which, in theory, could be more than what was available in the buffer.
* core: add a spsc ringbuffer implementationStefano Pigozzi2013-06-161-0/+155
Currently every single AO was implementing it's own ringbuffer, many times with slightly different semantics. This is an attempt to fix the problem. I stole some good ideas from ao_portaudio's ringbuffer and went from there. The main difference is this one stores wpos and rpos which are absolute positions in an "infinite" buffer. To find the actual position for writing / reading just apply modulo size. The producer only modifies wpos while the consumer only modifies rpos. This makes it pretty easy to reason about and make the operations thread safe by using barriers (thread safety is guaranteed only in the Single-Producer/Single- Consumer case). Also adapted ao_coreaudio to use this ringbuffer.