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/modules/module-combine.c | 4 ++-- src/modules/rtp/module-rtp-recv.c | 2 +- src/pulsecore/sink.c | 11 +++++------ src/pulsecore/sink.h | 3 ++- src/pulsecore/source.c | 9 ++++----- src/pulsecore/source.h | 3 ++- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c index 16de6890..92716552 100644 --- a/src/modules/module-combine.c +++ b/src/modules/module-combine.c @@ -455,12 +455,12 @@ static void sink_input_attach_cb(pa_sink_input *i) { pa_assert(!o->inq_rtpoll_item_read && !o->outq_rtpoll_item_write); o->inq_rtpoll_item_read = pa_rtpoll_item_new_asyncmsgq_read( - i->sink->rtpoll, + i->sink->thread_info.rtpoll, PA_RTPOLL_LATE, /* This one is not that important, since we check for data in _peek() anyway. */ o->inq); o->outq_rtpoll_item_write = pa_rtpoll_item_new_asyncmsgq_write( - i->sink->rtpoll, + i->sink->thread_info.rtpoll, PA_RTPOLL_EARLY, o->outq); } diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c index 5caf8272..c195c045 100644 --- a/src/modules/rtp/module-rtp-recv.c +++ b/src/modules/rtp/module-rtp-recv.c @@ -361,7 +361,7 @@ static void sink_input_attach(pa_sink_input *i) { pa_assert_se(s = i->userdata); pa_assert(!s->rtpoll_item); - s->rtpoll_item = pa_rtpoll_item_new(i->sink->rtpoll, PA_RTPOLL_LATE, 1); + s->rtpoll_item = pa_rtpoll_item_new(i->sink->thread_info.rtpoll, PA_RTPOLL_LATE, 1); p = pa_rtpoll_item_get_pollfd(s->rtpoll_item, NULL); p->fd = s->rtp_context.fd; 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