mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-15 06:59:58 -05:00
add new module "module-x11-bell"
fix scache memory leak git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@100 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
5a694fd508
commit
8705af792b
6 changed files with 204 additions and 15 deletions
|
|
@ -1,9 +1,11 @@
|
|||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "scache.h"
|
||||
#include "sink-input.h"
|
||||
#include "mainloop.h"
|
||||
|
||||
static void free_entry(struct pa_scache_entry *e) {
|
||||
assert(e);
|
||||
|
|
@ -70,7 +72,8 @@ int pa_scache_remove_item(struct pa_core *c, const char *name) {
|
|||
return -1;
|
||||
|
||||
pa_hashmap_remove(c->scache_hashmap, name);
|
||||
pa_idxset_remove_by_index(c->scache_idxset, e->index);
|
||||
if (pa_idxset_remove_by_data(c->scache_idxset, e, NULL) != e)
|
||||
assert(0);
|
||||
free_entry(e);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -113,10 +116,14 @@ static int sink_input_peek(struct pa_sink_input *i, struct pa_memchunk *chunk) {
|
|||
assert(c->length && c->memblock && c->memblock->length);
|
||||
*chunk = *c;
|
||||
pa_memblock_ref(c->memblock);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void si_kill(void *i) {
|
||||
sink_input_kill(i);
|
||||
}
|
||||
|
||||
static void sink_input_drop(struct pa_sink_input *i, size_t length) {
|
||||
struct pa_memchunk *c;
|
||||
assert(i && length && i->userdata);
|
||||
|
|
@ -128,7 +135,7 @@ static void sink_input_drop(struct pa_sink_input *i, size_t length) {
|
|||
c->index += length;
|
||||
|
||||
if (c->length <= 0)
|
||||
sink_input_kill(i);
|
||||
pa_mainloop_api_once(i->sink->core->mainloop, si_kill, i);
|
||||
}
|
||||
|
||||
int pa_scache_play_item(struct pa_core *c, const char *name, struct pa_sink *sink, uint32_t volume) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue