Commit graph

53 commits

Author SHA1 Message Date
Lukasz Marek
78ca8cfc96 Client API: Add pa_stream_write_ext_free() function.
New function allows to pass data pointer that is a member
of the outer structure that need to be freed too when data
is not needed anymore.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
2014-09-10 10:12:08 +02:00
David Henningsson
710c4b39af memblock, pstream: Allow send/receive of remote writable memblocks
The shared ringbuffer memblock must be writable by both sides.
This makes it possible to send such a memblock over a pstream without
the "both sides writable" information getting lost.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-06-27 14:16:32 +02:00
David Henningsson
613177919f shm: Allow to open shm in writable mode
This is a preparation for the shm ringbuffer, which needs to be able
to be writable by both sides, because there are atomic variables they
both need to modify.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-06-27 14:16:32 +02:00
Peter Meerwald
f4635818bd memblock: Fix typo in description of pa_memblock_unref_fixed(), cleanup
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-10-29 18:26:57 +02:00
Arun Raghavan
6825df8cec hashmap: Add the ability to free keys
Since the hashmap stores a pointer to the key provided at pa_hashmap_put()
time, it make sense to allow the hashmap to be given ownership of the key and
have it free it at pa_hashmap_remove/free time.

To do this cleanly, we now provide the key and value free functions at hashmap
creation time with a pa_hashmap_new_full. With this, we do away with the free
function that was provided at remove/free time for freeing the value.
2013-09-17 18:01:22 +05:30
poljar (Damir Jelić)
d806b19714 Remove pa_bool_t and replace it with bool.
commands used for this (executed from the pulseaudio/src directory):
    find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
        -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
        -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
        -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
        -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;

and:
    sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
        -e '181,194!s/\bTRUE\b/true/' -e \
        '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
2013-07-04 12:25:30 +03:00
Tanu Kaskinen
8872c238ba hashmap: Use pa_free_cb_t instead of pa_free2_cb_t
The previous patch removed module-gconf's dependency on the userdata
pointer of the free callback, and that was the only place where the
userdata pointer of pa_free2_cb_t was used, so now there's no need for
pa_free2_cb_t in pa_hashmap_free(). Using pa_free_cb_t instead allows
removing a significant amount of repetitive code.
2013-02-16 01:12:21 +02:00
Tanu Kaskinen
3d6092bb0f memblock: Add pa_memblock_acquire_chunk().
Besides making the code a bit cleaner, this also gets rid of
a few "cast increases required alignment of target type"
warnings.
2012-08-22 09:47:03 +03:00
Peter Meerwald
92fbb294b7 core: Fix comments. 2012-04-17 18:15:21 +03:00
Maarten Bosmans
c5dca7cf2b More spelling fixes 2011-08-25 11:27:47 +01:00
Lu Guanqun
5fe545de23 memblock: use built-in function
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
2011-08-15 09:41:56 +01:00
Lu Guanqun
ecbb4b4ef4 memblock: fix memory leak when pa_shm_create_rw fails
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
2011-08-15 09:41:56 +01:00
Maarten Bosmans
dd9265ac78 Remove unnecessary #includes 2011-06-22 23:12:20 +01:00
Maarten Bosmans
684b89c639 Fix up some double spaces 2011-03-18 09:20:07 +00:00
Maarten Bosmans
ecf09f2cd6 Fix up according to Coding Style
Only whitespace changes in here
2011-03-11 11:49:35 +00:00
Lennart Poettering
1250b5d735 ratelimit: fix log levels of log suppression messages
When logging a suppression message do so on the same log level as the
suppressed messages.

Cherry picked by Colin Guthrie from ec5a785712
with a couple of additional changes due to extra limiting in master
that was not present in stable-queue.
2011-01-31 11:36:24 +00:00
Lennart Poettering
744490a681 memblock: decrease tile size to 64k again 2009-10-28 21:29:01 +01:00
Jason Newton
cf8331a0da module-equalizer-sink: trying new buffering strategies 2009-09-29 23:50:52 -07:00
Lennart Poettering
9697c5dc18 memblock: don't try to reuse PA_MEMBLOCK_APPENDED memblocks since they usually are much bigger than we want them 2009-09-18 22:16:26 +02:00
Lennart Poettering
c010172c66 memblock: modernizations 2009-09-18 22:16:25 +02:00
Lennart Poettering
e2899f8bf3 memblock: make it easy to disable mempool usage with $PULSE_MEMPOOL_DISABLE 2009-09-17 01:21:56 +02:00
Lennart Poettering
e6a666d8d5 libpulse: introduce PA_BYTES_SNPRINT_MAX and make use of it wherever applicable 2009-09-06 22:33:04 +02:00
Lennart Poettering
286ab2f193 memblock: rate limit 'Pool full' message 2009-08-12 21:40:38 +02:00
Lennart Poettering
5e24b6dff5 memblock: try to hit an assert earlier when ref counting doesn't work 2009-07-24 15:49:22 +02:00
Lennart Poettering
28e4625a52 memblock: rearrange locking order 2009-07-01 20:20:55 +02:00
Lennart Poettering
684b4c116c memtrap: hook up core to memtrap system 2009-04-21 22:56:08 +02:00
Lennart Poettering
e41ec51f1b add simple ref counting debugging framework 2009-03-25 02:42:18 +01:00
Lennart Poettering
1737a19c86 allow importing of more memory blocks than exporting 2009-02-18 21:52:21 +01:00
Lennart Poettering
4e8ada521a show maximum usable slot size 2009-01-10 02:55:57 +01:00
Lennart Poettering
f728e9cce0 disable valgrind macro usage for now since valgrind generates a lot of spurious warnings as it seems 2008-10-05 22:51:25 +02:00
Lennart Poettering
79ad4e63f6 Make the shared memory segment size configurable
This is useful only on systems where memory overcommit is not available
or disabled.
2008-10-01 01:14:36 +02:00
Lennart Poettering
b7026bf248 add a few more gcc warning flags and fix quite a few problems found by doing so 2008-08-19 22:39:54 +02:00
Lennart Poettering
5cc2187bec add some code to make invalid valgrind warnings go away 2008-08-18 19:55:55 +02:00
Lennart Poettering
113c62bf5d halve memory consumption of mempool flist, since we know we cannot have more than n_blocks entries in it 2008-06-27 20:13:26 +02:00
Lennart Poettering
c26be0d762 modernize hashmap implementation a bit, reduce memory consumption a bit 2008-06-27 20:12:24 +02:00
Lennart Poettering
8ae83d618e get rid of svn $ keywords 2008-06-18 23:23:21 +03:00
Lennart Poettering
045c1d602d merge glitch-free branch back into trunk
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2445 fefdeb5f-60dc-0310-8127-8f9354f1896f
2008-05-15 23:34:41 +00:00
Lennart Poettering
a67c21f093 merge 'lennart' branch back into trunk.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1971 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-10-28 19:13:50 +00:00
Lennart Poettering
918cacb4f4 Replace AO_xxx usage with pa_atomic_xxx and friends wherever it makes sense
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1459 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-05-27 20:38:14 +00:00
Pierre Ossman
06211b7c8f Add copyright notices to all relevant files. (based on svn log)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1426 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-02-13 15:35:19 +00:00
Pierre Ossman
521daf6f0a Huge trailing whitespace cleanup. Let's keep the tree pure from here on,
mmmkay?


git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1418 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-01-04 13:43:45 +00:00
Pierre Ossman
8dc6214276 Revert r1404 and keep it on a development branch until it is fully tested.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1409 fefdeb5f-60dc-0310-8127-8f9354f1896f
2006-11-06 13:06:01 +00:00
Lennart Poettering
d210ebbb09 rework memory block management to be thread-safe and mostly lock-free.
pa_memblock is now an opaque structure. Access to its fields is now done
through various accessor functions in a thread-safe manner.

pa_memblock_acquire() and pa_memblock_release() are now used to access the
attached audio data. Why? To allow safe manipulation of the memory pointer
maintained by the memory block. Internally _acquire() and _release() maintain a
reference counter. Please do not confuse this reference counter whith the one
maintained by pa_memblock_ref()/_unref()!

As a side effect this patch removes all direct usages of AO_t and replaces it
with pa_atomic_xxx based code.

This stuff needs some serious testing love. Especially if threads are actively
used.



git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1404 fefdeb5f-60dc-0310-8127-8f9354f1896f
2006-09-26 23:50:56 +00:00
Lennart Poettering
791bbd8e0e don't maintain a list of allocated mempool slots, we don't use it anyway
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1380 fefdeb5f-60dc-0310-8127-8f9354f1896f
2006-09-07 20:17:25 +00:00
Lennart Poettering
5264d235d2 make pa_mempool_stat thread-safe/lock-free
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1343 fefdeb5f-60dc-0310-8127-8f9354f1896f
2006-08-29 02:01:39 +00:00
Lennart Poettering
327e0cd8e1 modify memory block reference counting to use the new reference counting API
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1342 fefdeb5f-60dc-0310-8127-8f9354f1896f
2006-08-29 01:16:47 +00:00
Pierre Ossman
2575b44637 fix typo
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1328 fefdeb5f-60dc-0310-8127-8f9354f1896f
2006-08-23 07:58:07 +00:00
Pierre Ossman
d964459a64 Fix detection of page size for non-POSIX systems.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1312 fefdeb5f-60dc-0310-8127-8f9354f1896f
2006-08-22 07:41:23 +00:00
Lennart Poettering
57f0b08cc1 generate per-type memory block statistics
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1293 fefdeb5f-60dc-0310-8127-8f9354f1896f
2006-08-19 16:25:15 +00:00
Lennart Poettering
fd3fe96ce5 add new function pa_mempool_is_shared() to test whether a memory pool is suitable for SHM data transfers
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1274 fefdeb5f-60dc-0310-8127-8f9354f1896f
2006-08-18 23:40:48 +00:00