~diwic/ubuntu/lucid/pulseaudio/bugfixes

« back to all changes in this revision

Viewing changes to src/pulsecore/core.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-05-05 14:18:20 UTC
  • mfrom: (1.2.4 upstream) (1.1.8 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090505141820-rrr2mtdd1jkllvr8
Tags: 1:0.9.15-1ubuntu1
* Merge from unreleased Debian pulseaudio git, remaining changes:
  - epoch (my stupid fault :S)
  - Don't build against, and create jack package. Jack is not in main
  - use linear resampler to work better with lack of PREEMPT in jaunty's
    -generic kernel config, also change buffer size
  - Add alsa configuration files to route alsa applications via pulseaudio
  - Move libasound2-plugins from Recommends to Depends
  - Add pm-utils sleep hook to suspend (and resume) users' pulseaudio
    daemons
  - patch to fix source/sink and suspend-on-idle race
  - Make initscript more informative in the default case of per-user
    sessions
  - create /var/run/pulse, and make restart more robust
  - add status check for system wide pulseaudio instance
  - LSB {Required-*,Should-*} should specify hal instead of dbus,
    since hal is required (and already requires dbus)
  - indicate that the system pulseaudio instance is being started from the init
    script
  - Install more upstream man pages
  - Link to pacat for parec man page
  - check whether pulseaudio is running before preloading the padsp library
  - Add DEB_OPT_FLAG = -O3 as per recommendation from
    pulseaudio-discuss/2007-December/001017.html
  - cache /usr/share/sounds/ubuntu/stereo/ wav files on pulseaudio load
  - disable glitch free (use tsched=0)
  - Generate a PO template on build
  - add special case to disable pulseaudio loading if accessibility/speech
    is being used
  - the sd wrapper script should not load pulseaudio if pulseaudio is being
    used as a system service
  - add a pulseaudio apport hook
  - fix some typos in README.Debian
  - demote paprefs to suggests
  - drop padevchooser(Recommends) and pavucontrol (Suggests)
  - drop libasyncns-dev build dependency, its in universe
* add libudev-dev as a build-dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
  PulseAudio is free software; you can redistribute it and/or modify
8
8
  it under the terms of the GNU Lesser General Public License as published
9
 
  by the Free Software Foundation; either version 2 of the License,
 
9
  by the Free Software Foundation; either version 2.1 of the License,
10
10
  or (at your option) any later version.
11
11
 
12
12
  PulseAudio is distributed in the hope that it will be useful, but
37
37
#include <pulsecore/namereg.h>
38
38
#include <pulsecore/core-util.h>
39
39
#include <pulsecore/core-scache.h>
40
 
#include <pulsecore/autoload.h>
41
40
#include <pulsecore/core-subscribe.h>
42
41
#include <pulsecore/shared.h>
43
42
#include <pulsecore/random.h>
91
90
    c->parent.parent.free = core_free;
92
91
    c->parent.process_msg = core_process_msg;
93
92
 
 
93
    c->state = PA_CORE_STARTUP;
94
94
    c->mainloop = m;
 
95
 
95
96
    c->clients = pa_idxset_new(NULL, NULL);
 
97
    c->cards = pa_idxset_new(NULL, NULL);
96
98
    c->sinks = pa_idxset_new(NULL, NULL);
97
99
    c->sources = pa_idxset_new(NULL, NULL);
 
100
    c->sink_inputs = pa_idxset_new(NULL, NULL);
98
101
    c->source_outputs = pa_idxset_new(NULL, NULL);
99
 
    c->sink_inputs = pa_idxset_new(NULL, NULL);
100
 
 
101
 
    c->default_source_name = c->default_sink_name = NULL;
102
 
 
103
 
    c->modules = NULL;
104
 
    c->namereg = NULL;
105
 
    c->scache = NULL;
106
 
    c->autoload_idxset = NULL;
107
 
    c->autoload_hashmap = NULL;
108
 
    c->running_as_daemon = FALSE;
 
102
    c->modules = pa_idxset_new(NULL, NULL);
 
103
    c->scache = pa_idxset_new(NULL, NULL);
 
104
 
 
105
    c->namereg = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 
106
    c->shared = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 
107
 
 
108
    c->default_source = NULL;
 
109
    c->default_sink = NULL;
109
110
 
110
111
    c->default_sample_spec.format = PA_SAMPLE_S16NE;
111
112
    c->default_sample_spec.rate = 44100;
112
113
    c->default_sample_spec.channels = 2;
 
114
    pa_channel_map_init_extend(&c->default_channel_map, c->default_sample_spec.channels, PA_CHANNEL_MAP_DEFAULT);
113
115
    c->default_n_fragments = 4;
114
116
    c->default_fragment_size_msec = 25;
115
117
 
116
 
    c->module_auto_unload_event = NULL;
117
118
    c->module_defer_unload_event = NULL;
118
119
    c->scache_auto_unload_event = NULL;
119
120
 
128
129
    c->exit_event = NULL;
129
130
 
130
131
    c->exit_idle_time = -1;
131
 
    c->module_idle_time = 20;
132
132
    c->scache_idle_time = 20;
133
133
 
134
 
    c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
135
 
 
 
134
    c->flat_volumes = TRUE;
136
135
    c->disallow_module_loading = FALSE;
137
136
    c->disallow_exit = FALSE;
 
137
    c->running_as_daemon = FALSE;
138
138
    c->realtime_scheduling = FALSE;
139
139
    c->realtime_priority = 5;
140
140
    c->disable_remixing = FALSE;
141
141
    c->disable_lfe_remixing = FALSE;
 
142
    c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
142
143
 
143
144
    for (j = 0; j < PA_CORE_HOOK_MAX; j++)
144
145
        pa_hook_init(&c->hooks[j], c);
145
146
 
146
 
    pa_shared_init(c);
147
 
 
148
147
    pa_random(&c->cookie, sizeof(c->cookie));
149
148
 
150
149
#ifdef SIGPIPE
153
152
 
154
153
    pa_core_check_idle(c);
155
154
 
 
155
    c->state = PA_CORE_RUNNING;
 
156
 
156
157
    return c;
157
158
}
158
159
 
161
162
    int j;
162
163
    pa_assert(c);
163
164
 
 
165
    c->state = PA_CORE_SHUTDOWN;
 
166
 
164
167
    pa_module_unload_all(c);
165
 
    pa_assert(!c->modules);
 
168
    pa_scache_free_all(c);
 
169
 
 
170
    pa_assert(pa_idxset_isempty(c->scache));
 
171
    pa_idxset_free(c->scache, NULL, NULL);
 
172
 
 
173
    pa_assert(pa_idxset_isempty(c->modules));
 
174
    pa_idxset_free(c->modules, NULL, NULL);
166
175
 
167
176
    pa_assert(pa_idxset_isempty(c->clients));
168
177
    pa_idxset_free(c->clients, NULL, NULL);
169
178
 
 
179
    pa_assert(pa_idxset_isempty(c->cards));
 
180
    pa_idxset_free(c->cards, NULL, NULL);
 
181
 
170
182
    pa_assert(pa_idxset_isempty(c->sinks));
171
183
    pa_idxset_free(c->sinks, NULL, NULL);
172
184
 
179
191
    pa_assert(pa_idxset_isempty(c->sink_inputs));
180
192
    pa_idxset_free(c->sink_inputs, NULL, NULL);
181
193
 
182
 
    pa_scache_free(c);
183
 
    pa_namereg_free(c);
184
 
    pa_autoload_free(c);
 
194
    pa_assert(pa_hashmap_isempty(c->namereg));
 
195
    pa_hashmap_free(c->namereg, NULL, NULL);
 
196
 
 
197
    pa_assert(pa_hashmap_isempty(c->shared));
 
198
    pa_hashmap_free(c->shared, NULL, NULL);
 
199
 
185
200
    pa_subscription_free_all(c);
186
201
 
187
202
    if (c->exit_event)
188
203
        c->mainloop->time_free(c->exit_event);
189
204
 
190
 
    pa_xfree(c->default_source_name);
191
 
    pa_xfree(c->default_sink_name);
 
205
    pa_assert(!c->default_source);
 
206
    pa_assert(!c->default_sink);
192
207
 
193
208
    pa_silence_cache_done(&c->silence_cache);
194
209
    pa_mempool_free(c->mempool);
195
210
 
196
 
    pa_shared_cleanup(c);
197
 
 
198
211
    for (j = 0; j < PA_CORE_HOOK_MAX; j++)
199
212
        pa_hook_done(&c->hooks[j]);
200
213
 
237
250
    c->mainloop->quit(c->mainloop, retval);
238
251
    return 0;
239
252
}
 
253
 
 
254
void pa_core_maybe_vacuum(pa_core *c) {
 
255
    pa_assert(c);
 
256
 
 
257
    if (!pa_idxset_isempty(c->sink_inputs) ||
 
258
        !pa_idxset_isempty(c->source_outputs))
 
259
        return;
 
260
 
 
261
    pa_log_debug("Hmm, no streams around, trying to vacuum.");
 
262
    pa_mempool_vacuum(c->mempool);
 
263
}