From 4eb59fb90e474a81f2d626bc4fc7db083fafed7a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 15 Aug 2009 00:26:00 +0200 Subject: core: move rtpoll to thread_info sub structure --- src/pulsecore/sink.c | 11 +++++------ src/pulsecore/sink.h | 3 ++- src/pulsecore/source.c | 9 ++++----- src/pulsecore/source.h | 3 ++- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/pulsecore') diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 90c9d85d..1f9a9797 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -262,7 +262,6 @@ pa_sink* pa_sink_new( s->userdata = NULL; s->asyncmsgq = NULL; - s->rtpoll = NULL; /* As a minor optimization we just steal the list instead of * copying it here */ @@ -295,6 +294,7 @@ pa_sink* pa_sink_new( &s->sample_spec, 0); + s->thread_info.rtpoll = NULL; s->thread_info.inputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); s->thread_info.soft_volume = s->soft_volume; s->thread_info.soft_muted = s->muted; @@ -421,7 +421,6 @@ void pa_sink_put(pa_sink* s) { /* The following fields must be initialized properly when calling _put() */ pa_assert(s->asyncmsgq); - pa_assert(s->rtpoll); pa_assert(s->thread_info.min_latency <= s->thread_info.max_latency); /* Generally, flags should be initialized via pa_sink_new(). As a @@ -563,12 +562,12 @@ void pa_sink_set_asyncmsgq(pa_sink *s, pa_asyncmsgq *q) { pa_source_set_asyncmsgq(s->monitor_source, q); } -/* Called from main context */ +/* Called from IO context, or before _put() from main context */ void pa_sink_set_rtpoll(pa_sink *s, pa_rtpoll *p) { pa_sink_assert_ref(s); - pa_assert_ctl_context(); + pa_sink_assert_io_context(s); - s->rtpoll = p; + s->thread_info.rtpoll = p; if (s->monitor_source) pa_source_set_rtpoll(s->monitor_source, p); @@ -1184,7 +1183,7 @@ pa_usec_t pa_sink_get_latency_within_thread(pa_sink *s) { o = PA_MSGOBJECT(s); - /* We probably should make this a proper vtable callback instead of going through process_msg() */ + /* FIXME: We probably should make this a proper vtable callback instead of going through process_msg() */ if (o->process_msg(o, PA_SINK_MESSAGE_GET_LATENCY, &usec, 0, NULL) < 0) return -1; diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h index 13033960..33145df3 100644 --- a/src/pulsecore/sink.h +++ b/src/pulsecore/sink.h @@ -102,7 +102,6 @@ struct pa_sink { pa_bool_t save_muted:1; pa_asyncmsgq *asyncmsgq; - pa_rtpoll *rtpoll; pa_memchunk silence; @@ -156,6 +155,8 @@ struct pa_sink { pa_sink_state_t state; pa_hashmap *inputs; + pa_rtpoll *rtpoll; + pa_cvolume soft_volume; pa_bool_t soft_muted:1; diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index a44275c0..028d6795 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -232,7 +232,6 @@ pa_source* pa_source_new( s->userdata = NULL; s->asyncmsgq = NULL; - s->rtpoll = NULL; /* As a minor optimization we just steal the list instead of * copying it here */ @@ -265,6 +264,7 @@ pa_source* pa_source_new( &s->sample_spec, 0); + s->thread_info.rtpoll = NULL; s->thread_info.outputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); s->thread_info.soft_volume = s->soft_volume; s->thread_info.soft_muted = s->muted; @@ -356,7 +356,6 @@ void pa_source_put(pa_source *s) { /* The following fields must be initialized properly when calling _put() */ pa_assert(s->asyncmsgq); - pa_assert(s->rtpoll); pa_assert(s->thread_info.min_latency <= s->thread_info.max_latency); /* Generally, flags should be initialized via pa_source_new(). As @@ -465,18 +464,18 @@ static void source_free(pa_object *o) { /* Called from main context */ void pa_source_set_asyncmsgq(pa_source *s, pa_asyncmsgq *q) { - pa_assert_ctl_context(); pa_source_assert_ref(s); + pa_assert_ctl_context(); s->asyncmsgq = q; } /* Called from main context */ void pa_source_set_rtpoll(pa_source *s, pa_rtpoll *p) { - pa_assert_ctl_context(); pa_source_assert_ref(s); + pa_source_assert_io_context(s); - s->rtpoll = p; + s->thread_info.rtpoll = p; } /* Called from main context */ diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h index 001122bc..6c0a2903 100644 --- a/src/pulsecore/source.h +++ b/src/pulsecore/source.h @@ -90,7 +90,6 @@ struct pa_source { pa_bool_t save_muted:1; pa_asyncmsgq *asyncmsgq; - pa_rtpoll *rtpoll; pa_memchunk silence; @@ -140,6 +139,8 @@ struct pa_source { pa_source_state_t state; pa_hashmap *outputs; + pa_rtpoll *rtpoll; + pa_cvolume soft_volume; pa_bool_t soft_muted:1; -- cgit