mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-19 07:00:03 -05:00
move pstream item allocation to pa_flist
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1628 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
d2fed9d419
commit
59c9ed5473
1 changed files with 14 additions and 6 deletions
|
|
@ -49,6 +49,7 @@
|
|||
#include <pulsecore/core-scache.h>
|
||||
#include <pulsecore/creds.h>
|
||||
#include <pulsecore/refcnt.h>
|
||||
#include <pulsecore/flist.h>
|
||||
|
||||
#include "pstream.h"
|
||||
|
||||
|
|
@ -84,6 +85,8 @@ typedef uint32_t pa_pstream_descriptor[PA_PSTREAM_DESCRIPTOR_MAX];
|
|||
#define FRAME_SIZE_MAX_ALLOW PA_SCACHE_ENTRY_SIZE_MAX /* allow uploading a single sample in one frame at max */
|
||||
#define FRAME_SIZE_MAX_USE (1024*64)
|
||||
|
||||
PA_STATIC_FLIST_DECLARE(items, 0, pa_xfree);
|
||||
|
||||
struct item_info {
|
||||
enum {
|
||||
PA_PSTREAM_ITEM_PACKET,
|
||||
|
|
@ -92,7 +95,6 @@ struct item_info {
|
|||
PA_PSTREAM_ITEM_SHMREVOKE
|
||||
} type;
|
||||
|
||||
|
||||
/* packet info */
|
||||
pa_packet *packet;
|
||||
#ifdef HAVE_CREDS
|
||||
|
|
@ -295,6 +297,7 @@ static void item_free(void *item, PA_GCC_UNUSED void *q) {
|
|||
pa_packet_unref(i->packet);
|
||||
}
|
||||
|
||||
if (pa_flist_push(PA_STATIC_FLIST_GET(items), i) < 0)
|
||||
pa_xfree(i);
|
||||
}
|
||||
|
||||
|
|
@ -330,7 +333,9 @@ void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_creds *cre
|
|||
if (p->dead)
|
||||
return;
|
||||
|
||||
if (!(i = pa_flist_pop(PA_STATIC_FLIST_GET(items))))
|
||||
i = pa_xnew(struct item_info, 1);
|
||||
|
||||
i->type = PA_PSTREAM_ITEM_PACKET;
|
||||
i->packet = pa_packet_ref(packet);
|
||||
|
||||
|
|
@ -362,6 +367,7 @@ void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa
|
|||
struct item_info *i;
|
||||
size_t n;
|
||||
|
||||
if (!(i = pa_flist_pop(PA_STATIC_FLIST_GET(items))))
|
||||
i = pa_xnew(struct item_info, 1);
|
||||
i->type = PA_PSTREAM_ITEM_MEMBLOCK;
|
||||
|
||||
|
|
@ -396,6 +402,7 @@ void pa_pstream_send_release(pa_pstream *p, uint32_t block_id) {
|
|||
|
||||
/* pa_log("Releasing block %u", block_id); */
|
||||
|
||||
if (!(item = pa_flist_pop(PA_STATIC_FLIST_GET(items))))
|
||||
item = pa_xnew(struct item_info, 1);
|
||||
item->type = PA_PSTREAM_ITEM_SHMRELEASE;
|
||||
item->block_id = block_id;
|
||||
|
|
@ -432,6 +439,7 @@ void pa_pstream_send_revoke(pa_pstream *p, uint32_t block_id) {
|
|||
return;
|
||||
/* pa_log("Revoking block %u", block_id); */
|
||||
|
||||
if (!(item = pa_flist_pop(PA_STATIC_FLIST_GET(items))))
|
||||
item = pa_xnew(struct item_info, 1);
|
||||
item->type = PA_PSTREAM_ITEM_SHMREVOKE;
|
||||
item->block_id = block_id;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue