[pulseaudio-commits] r1628 - /branches/lennart/src/pulsecore/pstream.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Fri Aug 10 17:10:30 PDT 2007
Author: lennart
Date: Sat Aug 11 02:10:29 2007
New Revision: 1628
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1628&root=3Dpulseaudio&vi=
ew=3Drev
Log:
move pstream item allocation to pa_flist
Modified:
branches/lennart/src/pulsecore/pstream.c
Modified: branches/lennart/src/pulsecore/pstream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
pstream.c?rev=3D1628&root=3Dpulseaudio&r1=3D1627&r2=3D1628&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/pstream.c (original)
+++ branches/lennart/src/pulsecore/pstream.c Sat Aug 11 02:10:29 2007
@@ -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 @@
#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,
@@ -91,7 +94,6 @@
PA_PSTREAM_ITEM_SHMRELEASE,
PA_PSTREAM_ITEM_SHMREVOKE
} type;
-
=
/* packet info */
pa_packet *packet;
@@ -295,7 +297,8 @@
pa_packet_unref(i->packet);
}
=
- pa_xfree(i);
+ if (pa_flist_push(PA_STATIC_FLIST_GET(items), i) < 0)
+ pa_xfree(i);
}
=
static void pstream_free(pa_pstream *p) {
@@ -330,7 +333,9 @@
if (p->dead)
return;
=
- i =3D pa_xnew(struct item_info, 1);
+ if (!(i =3D pa_flist_pop(PA_STATIC_FLIST_GET(items))))
+ i =3D pa_xnew(struct item_info, 1);
+ =
i->type =3D PA_PSTREAM_ITEM_PACKET;
i->packet =3D pa_packet_ref(packet);
=
@@ -362,7 +367,8 @@
struct item_info *i;
size_t n;
=
- i =3D pa_xnew(struct item_info, 1);
+ if (!(i =3D pa_flist_pop(PA_STATIC_FLIST_GET(items))))
+ i =3D pa_xnew(struct item_info, 1);
i->type =3D PA_PSTREAM_ITEM_MEMBLOCK;
=
n =3D length < FRAME_SIZE_MAX_USE ? length : FRAME_SIZE_MAX_USE;
@@ -396,7 +402,8 @@
=
/* pa_log("Releasing block %u", block_id); */
=
- item =3D pa_xnew(struct item_info, 1);
+ if (!(item =3D pa_flist_pop(PA_STATIC_FLIST_GET(items))))
+ item =3D pa_xnew(struct item_info, 1);
item->type =3D PA_PSTREAM_ITEM_SHMRELEASE;
item->block_id =3D block_id;
#ifdef HAVE_CREDS
@@ -432,7 +439,8 @@
return;
/* pa_log("Revoking block %u", block_id); */
=
- item =3D pa_xnew(struct item_info, 1);
+ if (!(item =3D pa_flist_pop(PA_STATIC_FLIST_GET(items))))
+ item =3D pa_xnew(struct item_info, 1);
item->type =3D PA_PSTREAM_ITEM_SHMREVOKE;
item->block_id =3D block_id;
#ifdef HAVE_CREDS
More information about the pulseaudio-commits
mailing list