summaryrefslogtreecommitdiffstats
path: root/polyp/scache.c
diff options
context:
space:
mode:
Diffstat (limited to 'polyp/scache.c')
-rw-r--r--polyp/scache.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/polyp/scache.c b/polyp/scache.c
index d2a84827..c1505046 100644
--- a/polyp/scache.c
+++ b/polyp/scache.c
@@ -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) {