summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-02-21 00:07:08 +0100
committerLennart Poettering <lennart@poettering.net>2010-02-21 00:07:08 +0100
commitacf6d421f5be7e20e13cfa5003b31b4afb527b8c (patch)
tree8dc22c4c621e1c3f3c962a1983a0a45b9ef42364
parent80cfd8ed384fdb6642c7bb931d9ee038d4d7b548 (diff)
pulse: fix finish notification for cached sample playback
-rw-r--r--src/pulse.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/pulse.c b/src/pulse.c
index 797e9fa..fcb6b05 100644
--- a/src/pulse.c
+++ b/src/pulse.c
@@ -343,7 +343,7 @@ static void context_subscribe_cb(pa_context *pc, pa_subscription_event_type_t t,
for (out = p->outstanding; out; out = n) {
n = out->next;
- if (!out->clean_up ||out->type != OUTSTANDING_SAMPLE || out->sink_input != idx)
+ if (!out->clean_up || out->type != OUTSTANDING_SAMPLE || out->sink_input != idx)
continue;
outstanding_disconnect(out);
@@ -954,6 +954,11 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal
pa_operation_unref(o);
+ if (!canceled && p->context && out->error == CA_SUCCESS) {
+ ret = CA_SUCCESS;
+ goto finish_locked;
+ }
+
pa_threaded_mainloop_unlock(p->mainloop);
/* The operation might have been canceled due to connection termination */
@@ -962,7 +967,7 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal
goto finish_unlocked;
}
- /* Did we manage to play the sample or did some other error occur? */
+ /* Did some other error occur? */
if (out->error != CA_ERROR_NOTFOUND) {
ret = out->error;
goto finish_unlocked;
@@ -1173,7 +1178,6 @@ int driver_cache(ca_context *c, ca_proplist *proplist) {
struct private *p;
pa_proplist *l = NULL;
const char *n, *ct;
- char *name = NULL;
pa_sample_spec ss;
pa_channel_map cm;
ca_bool_t cm_good;
@@ -1207,11 +1211,6 @@ int driver_cache(ca_context *c, ca_proplist *proplist) {
goto finish_unlocked;
}
- if (!(name = ca_strdup(n))) {
- ret = CA_ERROR_OOM;
- goto finish_unlocked;
- }
-
if ((ct = pa_proplist_gets(l, CA_PROP_CANBERRA_CACHE_CONTROL)))
if ((ret = ca_parse_cache_control(&cache_control, ct)) < 0) {
ret = CA_ERROR_INVALID;
@@ -1256,7 +1255,7 @@ int driver_cache(ca_context *c, ca_proplist *proplist) {
goto finish_locked;
}
- if (!(out->stream = pa_stream_new_with_proplist(p->context, name, &ss, cm_good ? &cm : NULL, l))) {
+ if (!(out->stream = pa_stream_new_with_proplist(p->context, NULL, &ss, cm_good ? &cm : NULL, l))) {
ret = translate_error(pa_context_errno(p->context));
goto finish_locked;
}
@@ -1308,8 +1307,6 @@ finish_unlocked:
if (l)
pa_proplist_free(l);
- ca_free(name);
-
return ret;
}