summaryrefslogtreecommitdiffstats
path: root/src/pulse/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulse/context.c')
-rw-r--r--src/pulse/context.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/pulse/context.c b/src/pulse/context.c
index 7c3717fa..e33143d9 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -128,6 +128,9 @@ static void reset_callbacks(pa_context *c) {
c->event_callback = NULL;
c->event_userdata = NULL;
+ c->ext_device_manager.callback = NULL;
+ c->ext_device_manager.userdata = NULL;
+
c->ext_stream_restore.callback = NULL;
c->ext_stream_restore.userdata = NULL;
}
@@ -707,10 +710,13 @@ static int context_autospawn(pa_context *c) {
if (c->spawn_api.atfork)
c->spawn_api.atfork();
+ /* We leave most of the cleaning up of the process environment
+ * to the executable. We only clean up the file descriptors to
+ * make sure the executable can actually be loaded
+ * correctly. */
pa_close_all(-1);
/* Setup argv */
-
argv[n++] = c->conf->daemon_binary;
argv[n++] = "--start";
@@ -1042,7 +1048,10 @@ pa_context_state_t pa_context_get_state(pa_context *c) {
}
int pa_context_errno(pa_context *c) {
- pa_assert(c);
+
+ if (!c)
+ return PA_ERR_INVALID;
+
pa_assert(PA_REFCNT_VALUE(c) >= 1);
return c->error;
@@ -1428,6 +1437,8 @@ void pa_command_extension(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t
if (!strcmp(name, "module-stream-restore"))
pa_ext_stream_restore_command(c, tag, t);
+ else if (!strcmp(name, "module-device-manager"))
+ pa_ext_device_manager_command(c, tag, t);
else
pa_log(_("Received message for unknown extension '%s'"), name);
@@ -1477,6 +1488,7 @@ pa_time_event* pa_context_rttime_new(pa_context *c, pa_usec_t usec, pa_time_even
struct timeval tv;
pa_assert(c);
+ pa_assert(PA_REFCNT_VALUE(c) >= 1);
pa_assert(c->mainloop);
if (usec == PA_USEC_INVALID)
@@ -1491,8 +1503,10 @@ void pa_context_rttime_restart(pa_context *c, pa_time_event *e, pa_usec_t usec)
struct timeval tv;
pa_assert(c);
+ pa_assert(PA_REFCNT_VALUE(c) >= 1);
pa_assert(c->mainloop);
+
if (usec == PA_USEC_INVALID)
c->mainloop->time_restart(e, NULL);
else {
@@ -1500,3 +1514,17 @@ void pa_context_rttime_restart(pa_context *c, pa_time_event *e, pa_usec_t usec)
c->mainloop->time_restart(e, &tv);
}
}
+
+size_t pa_context_get_tile_size(pa_context *c, const pa_sample_spec *ss) {
+ size_t fs, mbs;
+
+ pa_assert(c);
+ pa_assert(PA_REFCNT_VALUE(c) >= 1);
+
+ PA_CHECK_VALIDITY_RETURN_ANY(c, !pa_detect_fork(), PA_ERR_FORKED, (size_t) -1);
+ PA_CHECK_VALIDITY_RETURN_ANY(c, !ss || pa_sample_spec_valid(ss), PA_ERR_INVALID, (size_t) -1);
+
+ fs = ss ? pa_frame_size(ss) : 1;
+ mbs = PA_ROUND_DOWN(pa_mempool_block_size_max(c->mempool), fs);
+ return PA_MAX(mbs, fs);
+}