diff --git a/srcpkgs/pulseaudio/libpulseaudio.template b/srcpkgs/pulseaudio/libpulseaudio.template index 0d80dc4920a..43f7a60e66e 100644 --- a/srcpkgs/pulseaudio/libpulseaudio.template +++ b/srcpkgs/pulseaudio/libpulseaudio.template @@ -9,7 +9,7 @@ long_desc=" This package provides client libraries used by applications that access a PulseAudio sound server via PulseAudio's native interface." -revision=1 +revision=2 Add_dependency run glibc Add_dependency run libltdl diff --git a/srcpkgs/pulseaudio/patches/0001-dbus-remove-filter-functions-only-if-they-were-actua.patch b/srcpkgs/pulseaudio/patches/0001-dbus-remove-filter-functions-only-if-they-were-actua.patch new file mode 100644 index 00000000000..4f91d62284d --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0001-dbus-remove-filter-functions-only-if-they-were-actua.patch @@ -0,0 +1,289 @@ +From c41ee00893b6b0d5cc48ee041b8e4835eac548f0 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 8 Jan 2010 20:06:21 +0100 +Subject: [PATCH 01/62] dbus: remove filter functions only if they were actually set before + +This fixes an assert when destructing modules that have not been fully +initialized. + +https://bugzilla.redhat.com/show_bug.cgi?id=548525 +--- + src/modules/bluetooth/bluetooth-util.c | 5 +++- + src/modules/bluetooth/module-bluetooth-device.c | 7 ++++- + src/modules/bluetooth/module-bluetooth-proximity.c | 11 ++++---- + src/modules/module-console-kit.c | 9 +++++- + src/modules/module-hal-detect.c | 10 ++++---- + src/pulse/context.c | 25 ++++--------------- + src/pulse/internal.h | 1 + + 7 files changed, 34 insertions(+), 34 deletions(-) + +diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c +index 47d6200..795d510 100644 +--- a/src/modules/bluetooth/bluetooth-util.c ++++ b/src/modules/bluetooth/bluetooth-util.c +@@ -37,6 +37,7 @@ struct pa_bluetooth_discovery { + PA_LLIST_HEAD(pa_dbus_pending, pending); + pa_hashmap *devices; + pa_hook hook; ++ pa_bool_t filter_added; + }; + + static void get_properties_reply(DBusPendingCall *pending, void *userdata); +@@ -788,6 +789,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) { + pa_log_error("Failed to add filter function"); + goto fail; + } ++ y->filter_added = TRUE; + + if (pa_dbus_add_matches( + pa_dbus_connection_get(y->connection), &err, +@@ -856,7 +858,8 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) { + "type='signal',sender='org.bluez',interface='org.bluez.AudioSink',member='PropertyChanged'", + "type='signal',sender='org.bluez',interface='org.bluez.AudioSource',member='PropertyChanged'", NULL); + +- dbus_connection_remove_filter(pa_dbus_connection_get(y->connection), filter_cb, y); ++ if (y->filter_added) ++ dbus_connection_remove_filter(pa_dbus_connection_get(y->connection), filter_cb, y); + + pa_dbus_connection_unref(y->connection); + } +diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c +index 0ba1421..19676df 100644 +--- a/src/modules/bluetooth/module-bluetooth-device.c ++++ b/src/modules/bluetooth/module-bluetooth-device.c +@@ -179,6 +179,8 @@ struct userdata { + + int stream_write_type; + int service_write_type, service_read_type; ++ ++ pa_bool_t filter_added; + }; + + #define FIXED_LATENCY_PLAYBACK_A2DP (25*PA_USEC_PER_MSEC) +@@ -2405,6 +2407,7 @@ int pa__init(pa_module* m) { + pa_log_error("Failed to add filter function"); + goto fail; + } ++ u->filter_added = TRUE; + + speaker = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='SpeakerGainChanged',path='%s'", u->path); + mike = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='MicrophoneGainChanged',path='%s'", u->path); +@@ -2494,7 +2497,9 @@ void pa__done(pa_module *m) { + pa_xfree(mike); + } + +- dbus_connection_remove_filter(pa_dbus_connection_get(u->connection), filter_cb, u); ++ if (u->filter_added) ++ dbus_connection_remove_filter(pa_dbus_connection_get(u->connection), filter_cb, u); ++ + pa_dbus_connection_unref(u->connection); + } + +diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c +index c4cfd73..3eed9ce 100644 +--- a/src/modules/bluetooth/module-bluetooth-proximity.c ++++ b/src/modules/bluetooth/module-bluetooth-proximity.c +@@ -92,7 +92,8 @@ struct userdata { + unsigned n_found; + unsigned n_unknown; + +- pa_bool_t muted; ++ pa_bool_t muted:1; ++ pa_bool_t filter_added:1; + }; + + static void update_volume(struct userdata *u) { +@@ -358,9 +359,10 @@ static int add_matches(struct userdata *u, pa_bool_t add) { + } else + dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter2, &e); + +- if (add) ++ if (add) { + pa_assert_se(dbus_connection_add_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u, NULL)); +- else ++ u->filter_added = TRUE; ++ } else if (u->filter_added) + dbus_connection_remove_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u); + + r = 0; +@@ -393,9 +395,6 @@ int pa__init(pa_module*m) { + u->sink_name = pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL)); + u->hci = pa_xstrdup(pa_modargs_get_value(ma, "hci", DEFAULT_HCI)); + u->hci_path = pa_sprintf_malloc("/org/bluez/%s", u->hci); +- u->n_found = u->n_unknown = 0; +- u->muted = FALSE; +- + u->bondings = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); + + if (!(u->dbus_connection = pa_dbus_bus_get(m->core, DBUS_BUS_SYSTEM, &e))) { +diff --git a/src/modules/module-console-kit.c b/src/modules/module-console-kit.c +index 103f5c4..875852f 100644 +--- a/src/modules/module-console-kit.c ++++ b/src/modules/module-console-kit.c +@@ -67,6 +67,7 @@ struct userdata { + pa_core *core; + pa_dbus_connection *connection; + pa_hashmap *sessions; ++ pa_bool_t filter_added; + }; + + static void add_session(struct userdata *u, const char *id) { +@@ -300,7 +301,7 @@ int pa__init(pa_module*m) { + goto fail; + } + +- m->userdata = u = pa_xnew(struct userdata, 1); ++ m->userdata = u = pa_xnew0(struct userdata, 1); + u->core = m->core; + u->module = m; + u->connection = connection; +@@ -311,6 +312,8 @@ int pa__init(pa_module*m) { + goto fail; + } + ++ u->filter_added = TRUE; ++ + if (pa_dbus_add_matches( + pa_dbus_connection_get(connection), &error, + "type='signal',sender='org.freedesktop.ConsoleKit',interface='org.freedesktop.ConsoleKit.Seat',member='SessionAdded'", +@@ -359,7 +362,9 @@ void pa__done(pa_module *m) { + "type='signal',sender='org.freedesktop.ConsoleKit',interface='org.freedesktop.ConsoleKit.Seat',member='SessionAdded'", + "type='signal',sender='org.freedesktop.ConsoleKit',interface='org.freedesktop.ConsoleKit.Seat',member='SessionRemoved'", NULL); + +- dbus_connection_remove_filter(pa_dbus_connection_get(u->connection), filter_cb, u); ++ if (u->filter_added) ++ dbus_connection_remove_filter(pa_dbus_connection_get(u->connection), filter_cb, u); ++ + pa_dbus_connection_unref(u->connection); + } + +diff --git a/src/modules/module-hal-detect.c b/src/modules/module-hal-detect.c +index 1851913..23d4010 100644 +--- a/src/modules/module-hal-detect.c ++++ b/src/modules/module-hal-detect.c +@@ -87,6 +87,7 @@ struct userdata { + #ifdef HAVE_OSS_OUTPUT + pa_bool_t init_subdevs; + #endif ++ pa_bool_t filter_added:1; + }; + + #define CAPABILITY_ALSA "alsa" +@@ -733,12 +734,9 @@ int pa__init(pa_module*m) { + goto fail; + } + +- m->userdata = u = pa_xnew(struct userdata, 1); ++ m->userdata = u = pa_xnew0(struct userdata, 1); + u->core = m->core; +- u->context = NULL; +- u->connection = NULL; + u->devices = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); +- u->capability = NULL; + + #ifdef HAVE_ALSA + u->use_tsched = TRUE; +@@ -800,6 +798,7 @@ int pa__init(pa_module*m) { + pa_log_error("Failed to add filter function"); + goto fail; + } ++ u->filter_added = TRUE; + + if (pa_dbus_add_matches( + pa_dbus_connection_get(u->connection), &error, +@@ -856,7 +855,8 @@ void pa__done(pa_module *m) { + "type='signal',sender='org.freedesktop.Hal',interface='org.freedesktop.Hal.Device.AccessControl',member='ACLRemoved'", + "type='signal',interface='org.pulseaudio.Server',member='DirtyGiveUpMessage'", NULL); + +- dbus_connection_remove_filter(pa_dbus_connection_get(u->connection), filter_cb, u); ++ if (u->filter_added) ++ dbus_connection_remove_filter(pa_dbus_connection_get(u->connection), filter_cb, u); + pa_dbus_connection_unref(u->connection); + } + +diff --git a/src/pulse/context.c b/src/pulse/context.c +index 7468d0a..c83230d 100644 +--- a/src/pulse/context.c ++++ b/src/pulse/context.c +@@ -145,7 +145,7 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char * + + pa_init_i18n(); + +- c = pa_xnew(pa_context, 1); ++ c = pa_xnew0(pa_context, 1); + PA_REFCNT_INIT(c); + + c->proplist = p ? pa_proplist_copy(p) : pa_proplist_new(); +@@ -157,9 +157,6 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char * + c->system_bus = c->session_bus = NULL; + #endif + c->mainloop = mainloop; +- c->client = NULL; +- c->pstream = NULL; +- c->pdispatch = NULL; + c->playback_streams = pa_dynarray_new(); + c->record_streams = pa_dynarray_new(); + c->client_index = PA_INVALID_INDEX; +@@ -170,22 +167,9 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char * + + c->error = PA_OK; + c->state = PA_CONTEXT_UNCONNECTED; +- c->ctag = 0; +- c->csyncid = 0; + + reset_callbacks(c); + +- c->is_local = FALSE; +- c->server_list = NULL; +- c->server = NULL; +- +- c->do_shm = FALSE; +- +- c->server_specified = FALSE; +- c->no_fail = FALSE; +- c->do_autospawn = FALSE; +- memset(&c->spawn_api, 0, sizeof(c->spawn_api)); +- + #ifndef MSG_NOSIGNAL + #ifdef SIGPIPE + pa_check_signal_is_blocked(SIGPIPE); +@@ -255,12 +239,14 @@ static void context_free(pa_context *c) { + + #ifdef HAVE_DBUS + if (c->system_bus) { +- dbus_connection_remove_filter(pa_dbus_wrap_connection_get(c->system_bus), filter_cb, c); ++ if (c->filter_added) ++ dbus_connection_remove_filter(pa_dbus_wrap_connection_get(c->system_bus), filter_cb, c); + pa_dbus_wrap_connection_free(c->system_bus); + } + + if (c->session_bus) { +- dbus_connection_remove_filter(pa_dbus_wrap_connection_get(c->session_bus), filter_cb, c); ++ if (c->filter_added) ++ dbus_connection_remove_filter(pa_dbus_wrap_connection_get(c->session_bus), filter_cb, c); + pa_dbus_wrap_connection_free(c->session_bus); + } + #endif +@@ -794,6 +780,7 @@ static void track_pulseaudio_on_dbus(pa_context *c, DBusBusType type, pa_dbus_wr + pa_log_warn("Failed to add filter function"); + goto fail; + } ++ c->filter_added = TRUE; + + if (pa_dbus_add_matches( + pa_dbus_wrap_connection_get(*conn), &error, +diff --git a/src/pulse/internal.h b/src/pulse/internal.h +index b371bfc..c3ebf74 100644 +--- a/src/pulse/internal.h ++++ b/src/pulse/internal.h +@@ -91,6 +91,7 @@ struct pa_context { + pa_bool_t no_fail:1; + pa_bool_t do_autospawn:1; + pa_bool_t use_rtclock:1; ++ pa_bool_t filter_added:1; + pa_spawn_api spawn_api; + + pa_strlist *server_list; +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0002-native-fix-request-counter-miscalculations.patch b/srcpkgs/pulseaudio/patches/0002-native-fix-request-counter-miscalculations.patch new file mode 100644 index 00000000000..52425678a96 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0002-native-fix-request-counter-miscalculations.patch @@ -0,0 +1,275 @@ +From 8d356659e69556fa25d0579a66084f820683e2b8 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 8 Jan 2010 20:07:34 +0100 +Subject: [PATCH 02/62] native: fix request counter miscalculations + +Do not subtract bytes the client sends us beyond what we requested from +our missing bytes counter. + +This was mostly a thinko that caused servers asking for too little data +when the client initially sent more data than requested, because that +data sent too much was accounted for twice. + +This commit fixes this miscalculation. + +http://bugzilla.redhat.com/show_bug.cgi?id=534130 +--- + src/pulse/stream.c | 4 ++ + src/pulsecore/memblockq.c | 101 ++++++++++++++++++--------------------- + src/pulsecore/protocol-native.c | 7 ++- + 3 files changed, 55 insertions(+), 57 deletions(-) + +diff --git a/src/pulse/stream.c b/src/pulse/stream.c +index d01985b..793277a 100644 +--- a/src/pulse/stream.c ++++ b/src/pulse/stream.c +@@ -741,6 +741,8 @@ void pa_command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tag + + s->requested_bytes += bytes; + ++ /* pa_log("got request for %lli, now at %lli", (long long) bytes, (long long) s->requested_bytes); */ ++ + if (s->requested_bytes > 0 && s->write_callback) + s->write_callback(s, (size_t) s->requested_bytes, s->write_userdata); + +@@ -1354,6 +1356,8 @@ int pa_stream_write( + * that's OK, the server side applies the same error */ + s->requested_bytes -= (seek == PA_SEEK_RELATIVE ? offset : 0) + (int64_t) length; + ++ /* pa_log("wrote %lli, now at %lli", (long long) length, (long long) s->requested_bytes); */ ++ + if (s->direction == PA_STREAM_PLAYBACK) { + + /* Update latency request correction */ +diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c +index 32758be..4641801 100644 +--- a/src/pulsecore/memblockq.c ++++ b/src/pulsecore/memblockq.c +@@ -55,8 +55,7 @@ struct pa_memblockq { + pa_bool_t in_prebuf; + pa_memchunk silence; + pa_mcalign *mcalign; +- int64_t missing; +- size_t requested; ++ int64_t missing, requested; + }; + + pa_memblockq* pa_memblockq_new( +@@ -84,8 +83,8 @@ pa_memblockq* pa_memblockq_new( + pa_log_debug("memblockq requested: maxlength=%lu, tlength=%lu, base=%lu, prebuf=%lu, minreq=%lu maxrewind=%lu", + (unsigned long) maxlength, (unsigned long) tlength, (unsigned long) base, (unsigned long) prebuf, (unsigned long) minreq, (unsigned long) maxrewind); + +- bq->missing = 0; +- bq->requested = bq->maxlength = bq->tlength = bq->prebuf = bq->minreq = bq->maxrewind = 0; ++ bq->missing = bq->requested = 0; ++ bq->maxlength = bq->tlength = bq->prebuf = bq->minreq = bq->maxrewind = 0; + bq->in_prebuf = TRUE; + + pa_memblockq_set_maxlength(bq, maxlength); +@@ -246,10 +245,34 @@ static pa_bool_t can_push(pa_memblockq *bq, size_t l) { + return TRUE; + } + ++static void write_index_changed(pa_memblockq *bq, int64_t old_write_index, pa_bool_t account) { ++ int64_t delta; ++ ++ pa_assert(bq); ++ ++ delta = bq->write_index - old_write_index; ++ ++ if (account) ++ bq->requested -= delta; ++ ++ /* pa_log("pushed/seeked %lli: requested counter at %lli, account=%i", (long long) delta, (long long) bq->requested, account); */ ++} ++ ++static void read_index_changed(pa_memblockq *bq, int64_t old_read_index) { ++ int64_t delta; ++ ++ pa_assert(bq); ++ ++ delta = bq->read_index - old_read_index; ++ bq->missing += delta; ++ ++ /* pa_log("popped %lli: missing counter at %lli", (long long) delta, (long long) bq->missing); */ ++} ++ + int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) { + struct list_item *q, *n; + pa_memchunk chunk; +- int64_t old, delta; ++ int64_t old; + + pa_assert(bq); + pa_assert(uchunk); +@@ -409,18 +432,7 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) { + + finish: + +- delta = bq->write_index - old; +- +- if (delta >= (int64_t) bq->requested) { +- delta -= (int64_t) bq->requested; +- bq->requested = 0; +- } else { +- bq->requested -= (size_t) delta; +- delta = 0; +- } +- +- bq->missing -= delta; +- ++ write_index_changed(bq, old, TRUE); + return 0; + } + +@@ -514,7 +526,7 @@ int pa_memblockq_peek(pa_memblockq* bq, pa_memchunk *chunk) { + } + + void pa_memblockq_drop(pa_memblockq *bq, size_t length) { +- int64_t old, delta; ++ int64_t old; + pa_assert(bq); + pa_assert(length % bq->base == 0); + +@@ -553,19 +565,21 @@ void pa_memblockq_drop(pa_memblockq *bq, size_t length) { + } + + drop_backlog(bq); +- +- delta = bq->read_index - old; +- bq->missing += delta; ++ read_index_changed(bq, old); + } + + void pa_memblockq_rewind(pa_memblockq *bq, size_t length) { ++ int64_t old; + pa_assert(bq); + pa_assert(length % bq->base == 0); + ++ old = bq->read_index; ++ + /* This is kind of the inverse of pa_memblockq_drop() */ + + bq->read_index -= (int64_t) length; +- bq->missing -= (int64_t) length; ++ ++ read_index_changed(bq, old); + } + + pa_bool_t pa_memblockq_is_readable(pa_memblockq *bq) { +@@ -602,7 +616,7 @@ size_t pa_memblockq_missing(pa_memblockq *bq) { + } + + void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, pa_bool_t account) { +- int64_t old, delta; ++ int64_t old; + pa_assert(bq); + + old = bq->write_index; +@@ -625,24 +639,11 @@ void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, pa + } + + drop_backlog(bq); +- +- delta = bq->write_index - old; +- +- if (account) { +- if (delta >= (int64_t) bq->requested) { +- delta -= (int64_t) bq->requested; +- bq->requested = 0; +- } else if (delta >= 0) { +- bq->requested -= (size_t) delta; +- delta = 0; +- } +- } +- +- bq->missing -= delta; ++ write_index_changed(bq, old, account); + } + + void pa_memblockq_flush_write(pa_memblockq *bq) { +- int64_t old, delta; ++ int64_t old; + pa_assert(bq); + + pa_memblockq_silence(bq); +@@ -651,22 +652,11 @@ void pa_memblockq_flush_write(pa_memblockq *bq) { + bq->write_index = bq->read_index; + + pa_memblockq_prebuf_force(bq); +- +- delta = bq->write_index - old; +- +- if (delta >= (int64_t) bq->requested) { +- delta -= (int64_t) bq->requested; +- bq->requested = 0; +- } else if (delta >= 0) { +- bq->requested -= (size_t) delta; +- delta = 0; +- } +- +- bq->missing -= delta; ++ write_index_changed(bq, old, TRUE); + } + + void pa_memblockq_flush_read(pa_memblockq *bq) { +- int64_t old, delta; ++ int64_t old; + pa_assert(bq); + + pa_memblockq_silence(bq); +@@ -675,9 +665,7 @@ void pa_memblockq_flush_read(pa_memblockq *bq) { + bq->read_index = bq->write_index; + + pa_memblockq_prebuf_force(bq); +- +- delta = bq->read_index - old; +- bq->missing += delta; ++ read_index_changed(bq, old); + } + + size_t pa_memblockq_get_tlength(pa_memblockq *bq) { +@@ -774,8 +762,11 @@ size_t pa_memblockq_pop_missing(pa_memblockq *bq) { + return 0; + + l = (size_t) bq->missing; ++ ++ bq->requested += bq->missing; + bq->missing = 0; +- bq->requested += l; ++ ++ /* pa_log("sent %lli: request counter is at %lli", (long long) l, (long long) bq->requested); */ + + return l; + } +diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c +index 6e35762..b7b3f59 100644 +--- a/src/pulsecore/protocol-native.c ++++ b/src/pulsecore/protocol-native.c +@@ -1113,6 +1113,8 @@ static playback_stream* playback_stream_new( + + *missing = (uint32_t) pa_memblockq_pop_missing(s->memblockq); + ++ /* pa_log("missing original: %li", (long int) *missing); */ ++ + *ss = s->sink_input->sample_spec; + *map = s->sink_input->channel_map; + +@@ -1137,11 +1139,12 @@ static void playback_stream_request_bytes(playback_stream *s) { + + m = pa_memblockq_pop_missing(s->memblockq); + +- /* pa_log("request_bytes(%lu) (tlength=%lu minreq=%lu length=%lu)", */ ++ /* pa_log("request_bytes(%lu) (tlength=%lu minreq=%lu length=%lu really missing=%lli)", */ + /* (unsigned long) m, */ + /* pa_memblockq_get_tlength(s->memblockq), */ + /* pa_memblockq_get_minreq(s->memblockq), */ +- /* pa_memblockq_get_length(s->memblockq)); */ ++ /* pa_memblockq_get_length(s->memblockq), */ ++ /* (long long) pa_memblockq_get_tlength(s->memblockq) - (long long) pa_memblockq_get_length(s->memblockq)); */ + + if (m <= 0) + return; +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0003-core-make-sure-we-always-return-a-valid-memblock-in-.patch b/srcpkgs/pulseaudio/patches/0003-core-make-sure-we-always-return-a-valid-memblock-in-.patch new file mode 100644 index 00000000000..5d02e8caf43 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0003-core-make-sure-we-always-return-a-valid-memblock-in-.patch @@ -0,0 +1,161 @@ +From 3eed219a50c943251b41814e779cc37daf47e8f4 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 8 Jan 2010 21:51:30 +0100 +Subject: [PATCH 03/62] core: make sure we always return a valid memblock in sink_input_pop() callbacks + +https://bugzilla.redhat.com/show_bug.cgi?id=553607 +--- + src/modules/module-combine.c | 2 +- + src/modules/module-ladspa-sink.c | 6 +++++- + src/pulsecore/play-memchunk.c | 6 +++++- + src/pulsecore/protocol-esound.c | 5 ++++- + src/pulsecore/protocol-simple.c | 6 +++++- + src/pulsecore/sound-file-stream.c | 5 ++++- + 6 files changed, 24 insertions(+), 6 deletions(-) + +diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c +index a186c89..62e6267 100644 +--- a/src/modules/module-combine.c ++++ b/src/modules/module-combine.c +@@ -890,7 +890,7 @@ static struct output *output_new(struct userdata *u, pa_sink *sink) { + 1, + 0, + 0, +- NULL); ++ &u->sink->silence); + + pa_assert_se(pa_idxset_put(u->outputs, o, NULL) == 0); + update_description(u); +diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c +index 994c778..185871b 100644 +--- a/src/modules/module-ladspa-sink.c ++++ b/src/modules/module-ladspa-sink.c +@@ -476,6 +476,7 @@ int pa__init(pa_module*m) { + unsigned long input_port, output_port, p, j, n_control; + unsigned c; + pa_bool_t *use_default = NULL; ++ pa_memchunk silence; + + pa_assert(m); + +@@ -514,7 +515,10 @@ int pa__init(pa_module*m) { + u = pa_xnew0(struct userdata, 1); + u->module = m; + m->userdata = u; +- u->memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, pa_frame_size(&ss), 1, 1, 0, NULL); ++ ++ pa_silence_memchunk_get(&m->core->silence_cache, m->core->mempool, &silence, &ss, 0); ++ u->memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, pa_frame_size(&ss), 1, 1, 0, &silence); ++ pa_memblock_unref(silence.memblock); + + if (!(e = getenv("LADSPA_PATH"))) + e = LADSPA_PATH; +diff --git a/src/pulsecore/play-memchunk.c b/src/pulsecore/play-memchunk.c +index f127d7a..1a3bd5b 100644 +--- a/src/pulsecore/play-memchunk.c ++++ b/src/pulsecore/play-memchunk.c +@@ -47,12 +47,16 @@ int pa_play_memchunk( + + pa_memblockq *q; + int r; ++ pa_memchunk silence; + + pa_assert(sink); + pa_assert(ss); + pa_assert(chunk); + +- q = pa_memblockq_new(0, chunk->length, 0, pa_frame_size(ss), 1, 1, 0, NULL); ++ pa_silence_memchunk_get(&sink->core->silence_cache, sink->core->mempool, &silence, ss, 0); ++ q = pa_memblockq_new(0, chunk->length, 0, pa_frame_size(ss), 1, 1, 0, &silence); ++ pa_memblock_unref(silence.memblock); ++ + pa_assert_se(pa_memblockq_push(q, chunk) >= 0); + + if ((r = pa_play_memblockq(sink, ss, map, q, volume, p, sink_input_index)) < 0) { +diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c +index 2326eb3..a89f327 100644 +--- a/src/pulsecore/protocol-esound.c ++++ b/src/pulsecore/protocol-esound.c +@@ -389,6 +389,7 @@ static int esd_proto_stream_play(connection *c, esd_proto_t request, const void + size_t l; + pa_sink *sink = NULL; + pa_sink_input_new_data sdata; ++ pa_memchunk silence; + + connection_assert_ref(c); + pa_assert(data); +@@ -435,6 +436,7 @@ static int esd_proto_stream_play(connection *c, esd_proto_t request, const void + CHECK_VALIDITY(c->sink_input, "Failed to create sink input."); + + l = (size_t) ((double) pa_bytes_per_second(&ss)*PLAYBACK_BUFFER_SECONDS); ++ pa_sink_input_get_silence(c->sink_input, &silence); + c->input_memblockq = pa_memblockq_new( + 0, + l, +@@ -443,7 +445,8 @@ static int esd_proto_stream_play(connection *c, esd_proto_t request, const void + (size_t) -1, + l/PLAYBACK_BUFFER_FRAGMENTS, + 0, +- NULL); ++ &silence); ++ pa_memblock_unref(silence.memblock); + pa_iochannel_socket_set_rcvbuf(c->io, l); + + c->sink_input->parent.process_msg = sink_input_process_msg; +diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c +index a9f7389..fb2e564 100644 +--- a/src/pulsecore/protocol-simple.c ++++ b/src/pulsecore/protocol-simple.c +@@ -525,6 +525,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp + + if (o->playback) { + pa_sink_input_new_data data; ++ pa_memchunk silence; + size_t l; + pa_sink *sink; + +@@ -559,6 +560,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp + pa_sink_input_set_requested_latency(c->sink_input, DEFAULT_SINK_LATENCY); + + l = (size_t) ((double) pa_bytes_per_second(&o->sample_spec)*PLAYBACK_BUFFER_SECONDS); ++ pa_sink_input_get_silence(c->sink_input, &silence); + c->input_memblockq = pa_memblockq_new( + 0, + l, +@@ -567,7 +569,9 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp + (size_t) -1, + l/PLAYBACK_BUFFER_FRAGMENTS, + 0, +- NULL); ++ &silence); ++ pa_memblock_unref(silence.memblock); ++ + pa_iochannel_socket_set_rcvbuf(io, l); + + pa_atomic_store(&c->playback.missing, (int) pa_memblockq_missing(c->input_memblockq)); +diff --git a/src/pulsecore/sound-file-stream.c b/src/pulsecore/sound-file-stream.c +index 16de492..2025c2a 100644 +--- a/src/pulsecore/sound-file-stream.c ++++ b/src/pulsecore/sound-file-stream.c +@@ -239,6 +239,7 @@ int pa_play_file( + pa_sink_input_new_data data; + int fd; + SF_INFO sfi; ++ pa_memchunk silence; + + pa_assert(sink); + pa_assert(fname); +@@ -324,7 +325,9 @@ int pa_play_file( + u->sink_input->state_change = sink_input_state_change_cb; + u->sink_input->userdata = u; + +- u->memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, pa_frame_size(&ss), 1, 1, 0, NULL); ++ pa_sink_input_get_silence(u->sink_input, &silence); ++ u->memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, pa_frame_size(&ss), 1, 1, 0, &silence); ++ pa_memblock_unref(silence.memblock); + + pa_sink_input_put(u->sink_input); + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0004-bluetooth-destruct-stream-only-if-it-is-not-already-.patch b/srcpkgs/pulseaudio/patches/0004-bluetooth-destruct-stream-only-if-it-is-not-already-.patch new file mode 100644 index 00000000000..4d28682a6d2 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0004-bluetooth-destruct-stream-only-if-it-is-not-already-.patch @@ -0,0 +1,56 @@ +From 11688eca4b2beb7aa1adcd4aa9a3ee933f7385fb Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 8 Jan 2010 22:18:15 +0100 +Subject: [PATCH 04/62] bluetooth: destruct stream only if it is not already destructed + +https://bugzilla.redhat.com/show_bug.cgi?id=551842 +--- + src/modules/bluetooth/module-bluetooth-device.c | 28 ++++++++++++---------- + 1 files changed, 15 insertions(+), 13 deletions(-) + +diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c +index 19676df..2bbae41 100644 +--- a/src/modules/bluetooth/module-bluetooth-device.c ++++ b/src/modules/bluetooth/module-bluetooth-device.c +@@ -823,23 +823,25 @@ static int stop_stream_fd(struct userdata *u) { + + pa_assert(u); + pa_assert(u->rtpoll); +- pa_assert(u->rtpoll_item); +- pa_assert(u->stream_fd >= 0); + +- pa_rtpoll_item_free(u->rtpoll_item); +- u->rtpoll_item = NULL; ++ if (u->rtpoll_item) { ++ pa_rtpoll_item_free(u->rtpoll_item); ++ u->rtpoll_item = NULL; ++ } + +- memset(msg.buf, 0, BT_SUGGESTED_BUFFER_SIZE); +- msg.start_req.h.type = BT_REQUEST; +- msg.start_req.h.name = BT_STOP_STREAM; +- msg.start_req.h.length = sizeof(msg.start_req); ++ if (u->stream_fd >= 0) { ++ memset(msg.buf, 0, BT_SUGGESTED_BUFFER_SIZE); ++ msg.start_req.h.type = BT_REQUEST; ++ msg.start_req.h.name = BT_STOP_STREAM; ++ msg.start_req.h.length = sizeof(msg.start_req); + +- if (service_send(u, &msg.start_req.h) < 0 || +- service_expect(u, &msg.rsp, sizeof(msg), BT_STOP_STREAM, sizeof(msg.start_rsp)) < 0) +- r = -1; ++ if (service_send(u, &msg.start_req.h) < 0 || ++ service_expect(u, &msg.rsp, sizeof(msg), BT_STOP_STREAM, sizeof(msg.start_rsp)) < 0) ++ r = -1; + +- pa_close(u->stream_fd); +- u->stream_fd = -1; ++ pa_close(u->stream_fd); ++ u->stream_fd = -1; ++ } + + if (u->read_smoother) { + pa_smoother_free(u->read_smoother); +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0005-bluetooth-don-t-hit-an-assert-if-latency-is-queried-.patch b/srcpkgs/pulseaudio/patches/0005-bluetooth-don-t-hit-an-assert-if-latency-is-queried-.patch new file mode 100644 index 00000000000..fbb3ef940b1 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0005-bluetooth-don-t-hit-an-assert-if-latency-is-queried-.patch @@ -0,0 +1,35 @@ +From e7d9f891e2a8e6b670098b80315ca1f0010c35ca Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 8 Jan 2010 23:44:42 +0100 +Subject: [PATCH 05/62] bluetooth: don't hit an assert if latency is queried for a stooped recording stream + +https://bugzilla.redhat.com/show_bug.cgi?id=537422 +--- + src/modules/bluetooth/module-bluetooth-device.c | 10 +++++++--- + 1 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c +index 2bbae41..d6868b8 100644 +--- a/src/modules/bluetooth/module-bluetooth-device.c ++++ b/src/modules/bluetooth/module-bluetooth-device.c +@@ -972,10 +972,14 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off + case PA_SOURCE_MESSAGE_GET_LATENCY: { + pa_usec_t wi, ri; + +- wi = pa_smoother_get(u->read_smoother, pa_rtclock_now()); +- ri = pa_bytes_to_usec(u->read_index, &u->sample_spec); ++ if (u->read_smoother) { ++ wi = pa_smoother_get(u->read_smoother, pa_rtclock_now()); ++ ri = pa_bytes_to_usec(u->read_index, &u->sample_spec); ++ ++ *((pa_usec_t*) data) = (wi > ri ? wi - ri : 0) + u->source->thread_info.fixed_latency; ++ } else ++ *((pa_usec_t*) data) = 0; + +- *((pa_usec_t*) data) = (wi > ri ? wi - ri : 0) + u->source->thread_info.fixed_latency; + return 0; + } + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0006-client-detect-forking-in-sample-cache-API-too.patch b/srcpkgs/pulseaudio/patches/0006-client-detect-forking-in-sample-cache-API-too.patch new file mode 100644 index 00000000000..8466fd26b93 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0006-client-detect-forking-in-sample-cache-API-too.patch @@ -0,0 +1,87 @@ +From bf50dc42306857e361267d2ad39b737ad05b8604 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 12 Jan 2010 03:01:14 +0100 +Subject: [PATCH 06/62] client: detect forking in sample cache API, too + +--- + src/pulse/scache.c | 9 +++++++-- + src/pulse/stream.c | 1 + + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/pulse/scache.c b/src/pulse/scache.c +index 27da688..2a7602f 100644 +--- a/src/pulse/scache.c ++++ b/src/pulse/scache.c +@@ -28,15 +28,15 @@ + #include + + #include ++#include + + #include + #include + #include + ++#include "fork-detect.h" + #include "internal.h" + +-#include "scache.h" +- + int pa_stream_connect_upload(pa_stream *s, size_t length) { + pa_tagstruct *t; + uint32_t tag; +@@ -45,6 +45,7 @@ int pa_stream_connect_upload(pa_stream *s, size_t length) { + pa_assert(s); + pa_assert(PA_REFCNT_VALUE(s) >= 1); + ++ PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED); + PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_UNCONNECTED, PA_ERR_BADSTATE); + PA_CHECK_VALIDITY(s->context, length > 0, PA_ERR_INVALID); + PA_CHECK_VALIDITY(s->context, length == (size_t) (uint32_t) length, PA_ERR_INVALID); +@@ -85,6 +86,7 @@ int pa_stream_finish_upload(pa_stream *s) { + pa_assert(s); + pa_assert(PA_REFCNT_VALUE(s) >= 1); + ++ PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED); + PA_CHECK_VALIDITY(s->context, s->channel_valid, PA_ERR_BADSTATE); + PA_CHECK_VALIDITY(s->context, s->context->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + +@@ -174,6 +176,7 @@ pa_operation *pa_context_play_sample(pa_context *c, const char *name, const char + pa_assert(c); + pa_assert(PA_REFCNT_VALUE(c) >= 1); + ++ PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED); + PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID); + PA_CHECK_VALIDITY_RETURN_NULL(c, !dev || *dev, PA_ERR_INVALID); +@@ -213,6 +216,7 @@ pa_operation *pa_context_play_sample_with_proplist(pa_context *c, const char *na + pa_assert(c); + pa_assert(PA_REFCNT_VALUE(c) >= 1); + ++ PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED); + PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID); + PA_CHECK_VALIDITY_RETURN_NULL(c, !dev || *dev, PA_ERR_INVALID); +@@ -255,6 +259,7 @@ pa_operation* pa_context_remove_sample(pa_context *c, const char *name, pa_conte + pa_assert(c); + pa_assert(PA_REFCNT_VALUE(c) >= 1); + ++ PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED); + PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID); + +diff --git a/src/pulse/stream.c b/src/pulse/stream.c +index 793277a..79b2868 100644 +--- a/src/pulse/stream.c ++++ b/src/pulse/stream.c +@@ -29,6 +29,7 @@ + #include + + #include ++#include + #include + #include + #include +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0007-client-verify-connection-state-in-pa_stream_connect_.patch b/srcpkgs/pulseaudio/patches/0007-client-verify-connection-state-in-pa_stream_connect_.patch new file mode 100644 index 00000000000..b9cd10d907e --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0007-client-verify-connection-state-in-pa_stream_connect_.patch @@ -0,0 +1,28 @@ +From 78811c5653d0ba508b6558ba4578b61da26c60cf Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 12 Jan 2010 03:01:27 +0100 +Subject: [PATCH 07/62] client: verify connection state in pa_stream_connect_upload() + +Make suer we check the connection state before going on, so that we can +rely that s->context->pstream is properly initialized. + +https://bugzilla.redhat.com/show_bug.cgi?id=539500 +--- + src/pulse/scache.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/src/pulse/scache.c b/src/pulse/scache.c +index 2a7602f..b2169b6 100644 +--- a/src/pulse/scache.c ++++ b/src/pulse/scache.c +@@ -49,6 +49,7 @@ int pa_stream_connect_upload(pa_stream *s, size_t length) { + PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_UNCONNECTED, PA_ERR_BADSTATE); + PA_CHECK_VALIDITY(s->context, length > 0, PA_ERR_INVALID); + PA_CHECK_VALIDITY(s->context, length == (size_t) (uint32_t) length, PA_ERR_INVALID); ++ PA_CHECK_VALIDITY(s->context, s->context->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + + if (!(name = pa_proplist_gets(s->proplist, PA_PROP_EVENT_ID))) + name = pa_proplist_gets(s->proplist, PA_PROP_MEDIA_NAME); +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0008-udev-don-t-forget-to-unref-devices-we-are-not-intere.patch b/srcpkgs/pulseaudio/patches/0008-udev-don-t-forget-to-unref-devices-we-are-not-intere.patch new file mode 100644 index 00000000000..30cfa271fc2 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0008-udev-don-t-forget-to-unref-devices-we-are-not-intere.patch @@ -0,0 +1,29 @@ +From 15a3018bda8ee92393671ceaf272be418e95a81f Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 12 Jan 2010 23:01:24 +0100 +Subject: [PATCH 08/62] udev: don't forget to unref devices we are not interested in + +https://bugzilla.redhat.com/show_bug.cgi?id=552932 +--- + src/modules/module-udev-detect.c | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c +index 1b1e9c1..7508d9a 100644 +--- a/src/modules/module-udev-detect.c ++++ b/src/modules/module-udev-detect.c +@@ -416,8 +416,10 @@ static void monitor_cb( + goto fail; + } + +- if (!path_get_card_id(udev_device_get_devpath(dev))) ++ if (!path_get_card_id(udev_device_get_devpath(dev))) { ++ udev_device_unref(dev); + return; ++ } + + process_device(u, dev); + udev_device_unref(dev); +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0009-once-make-once-related-variables-volatile.patch b/srcpkgs/pulseaudio/patches/0009-once-make-once-related-variables-volatile.patch new file mode 100644 index 00000000000..e07ac4f6acb --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0009-once-make-once-related-variables-volatile.patch @@ -0,0 +1,91 @@ +From 73ae1fce001253677b7ab633f42d3c3300fe5cf5 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 12 Jan 2010 23:03:04 +0100 +Subject: [PATCH 09/62] once: make once related variables volatile + +--- + src/pulsecore/flist.h | 2 +- + src/pulsecore/once.c | 3 +-- + src/pulsecore/thread-posix.c | 8 ++------ + src/pulsecore/thread.h | 2 +- + 4 files changed, 5 insertions(+), 10 deletions(-) + +diff --git a/src/pulsecore/flist.h b/src/pulsecore/flist.h +index e147486..184e599 100644 +--- a/src/pulsecore/flist.h ++++ b/src/pulsecore/flist.h +@@ -45,7 +45,7 @@ void* pa_flist_pop(pa_flist*l); + + #define PA_STATIC_FLIST_DECLARE(name, size, free_cb) \ + static struct { \ +- pa_flist *flist; \ ++ pa_flist *volatile flist; \ + pa_once once; \ + } name##_flist = { NULL, PA_ONCE_INIT }; \ + static void name##_flist_init(void) { \ +diff --git a/src/pulsecore/once.c b/src/pulsecore/once.c +index 05a3ad2..4e509e0 100644 +--- a/src/pulsecore/once.c ++++ b/src/pulsecore/once.c +@@ -29,8 +29,6 @@ + #include "once.h" + + pa_bool_t pa_once_begin(pa_once *control) { +- pa_mutex *m; +- + pa_assert(control); + + if (pa_atomic_load(&control->done)) +@@ -43,6 +41,7 @@ pa_bool_t pa_once_begin(pa_once *control) { + * executed by us. Hence the awkward locking. */ + + for (;;) { ++ pa_mutex *m; + + if ((m = pa_atomic_ptr_load(&control->mutex))) { + +diff --git a/src/pulsecore/thread-posix.c b/src/pulsecore/thread-posix.c +index fdab270..bc0d6e3 100644 +--- a/src/pulsecore/thread-posix.c ++++ b/src/pulsecore/thread-posix.c +@@ -80,11 +80,9 @@ pa_thread* pa_thread_new(pa_thread_func_t thread_func, void *userdata) { + + pa_assert(thread_func); + +- t = pa_xnew(pa_thread, 1); ++ t = pa_xnew0(pa_thread, 1); + t->thread_func = thread_func; + t->userdata = userdata; +- t->joined = FALSE; +- pa_atomic_store(&t->running, 0); + + if (pthread_create(&t->id, NULL, internal_thread_func, t) < 0) { + pa_xfree(t); +@@ -135,10 +133,8 @@ pa_thread* pa_thread_self(void) { + /* This is a foreign thread, let's create a pthread structure to + * make sure that we can always return a sensible pointer */ + +- t = pa_xnew(pa_thread, 1); ++ t = pa_xnew0(pa_thread, 1); + t->id = pthread_self(); +- t->thread_func = NULL; +- t->userdata = NULL; + t->joined = TRUE; + pa_atomic_store(&t->running, 2); + +diff --git a/src/pulsecore/thread.h b/src/pulsecore/thread.h +index 25eace6..60c1267 100644 +--- a/src/pulsecore/thread.h ++++ b/src/pulsecore/thread.h +@@ -55,7 +55,7 @@ void *pa_tls_set(pa_tls *t, void *userdata); + #define PA_STATIC_TLS_DECLARE(name, free_cb) \ + static struct { \ + pa_once once; \ +- pa_tls *tls; \ ++ pa_tls *volatile tls; \ + } name##_tls = { \ + .once = PA_ONCE_INIT, \ + .tls = NULL \ +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0010-bluetooth-fix-invalid-memory-access.patch b/srcpkgs/pulseaudio/patches/0010-bluetooth-fix-invalid-memory-access.patch new file mode 100644 index 00000000000..8baf40c224b --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0010-bluetooth-fix-invalid-memory-access.patch @@ -0,0 +1,36 @@ +From 4bcb1a909f936a63628273e7d35726bc64785eeb Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 13 Jan 2010 17:24:37 +0100 +Subject: [PATCH 10/62] bluetooth: fix invalid memory access + +When an GetProperties() reply arrives after we already deleted the +device structure for it make sure we don't accidentaly touch the +invalidated object. + +https://bugzilla.redhat.com/show_bug.cgi?id=543205 +--- + src/modules/bluetooth/bluetooth-util.c | 8 +++++++- + 1 files changed, 7 insertions(+), 1 deletions(-) + +diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c +index 795d510..b2c0429 100644 +--- a/src/modules/bluetooth/bluetooth-util.c ++++ b/src/modules/bluetooth/bluetooth-util.c +@@ -342,7 +342,13 @@ static void get_properties_reply(DBusPendingCall *pending, void *userdata) { + /* dbus_message_get_interface(p->message), */ + /* dbus_message_get_path(p->message)); */ + +- d = p->call_data; ++ /* We don't use p->call_data here right-away since the device ++ * might already be invalidated at this point */ ++ ++ if (!(d = pa_hashmap_get(y->devices, dbus_message_get_path(p->message)))) ++ return; ++ ++ pa_assert(p->call_data == d); + + valid = dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR ? -1 : 1; + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0011-log-add-an-easy-way-to-disable-log-rate-limiting.patch b/srcpkgs/pulseaudio/patches/0011-log-add-an-easy-way-to-disable-log-rate-limiting.patch new file mode 100644 index 00000000000..bdefce0ba83 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0011-log-add-an-easy-way-to-disable-log-rate-limiting.patch @@ -0,0 +1,154 @@ +From 21b484e056be445fdaf00f91ce50bc40b1ac9623 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 13 Jan 2010 17:35:04 +0100 +Subject: [PATCH 11/62] log: add an easy way to disable log rate limiting + +Should help with debuggin bugs like: + +https://bugzilla.redhat.com/show_bug.cgi?id=554405 +--- + src/pulsecore/log.c | 88 +++++++++++++++++++++++++++++---------------------- + 1 files changed, 50 insertions(+), 38 deletions(-) + +diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c +index 8c21ee6..0c5a317 100644 +--- a/src/pulsecore/log.c ++++ b/src/pulsecore/log.c +@@ -61,6 +61,7 @@ + #define ENV_LOG_PRINT_LEVEL "PULSE_LOG_LEVEL" + #define ENV_LOG_BACKTRACE "PULSE_LOG_BACKTRACE" + #define ENV_LOG_BACKTRACE_SKIP "PULSE_LOG_BACKTRACE_SKIP" ++#define ENV_LOG_NO_RATELIMIT "PULSE_LOG_NO_RATE_LIMIT" + + static char *ident = NULL; /* in local charset format */ + static pa_log_target_t target = PA_LOG_STDERR, target_override; +@@ -68,6 +69,7 @@ static pa_bool_t target_override_set = FALSE; + static pa_log_level_t maximum_level = PA_LOG_ERROR, maximum_level_override = PA_LOG_ERROR; + static unsigned show_backtrace = 0, show_backtrace_override = 0, skip_backtrace = 0; + static pa_log_flags_t flags = 0, flags_override = 0; ++static pa_bool_t no_rate_limit = FALSE; + + #ifdef HAVE_SYSLOG_H + static const int level_to_syslog[] = { +@@ -195,54 +197,61 @@ static char* get_backtrace(unsigned show_nframes) { + #endif + + static void init_defaults(void) { +- const char *e; ++ PA_ONCE_BEGIN { + +- if (!ident) { +- char binary[256]; +- if (pa_get_binary_name(binary, sizeof(binary))) +- pa_log_set_ident(binary); +- } ++ const char *e; + +- if (getenv(ENV_LOG_SYSLOG)) { +- target_override = PA_LOG_SYSLOG; +- target_override_set = TRUE; +- } ++ if (!ident) { ++ char binary[256]; ++ if (pa_get_binary_name(binary, sizeof(binary))) ++ pa_log_set_ident(binary); ++ } + +- if ((e = getenv(ENV_LOG_LEVEL))) { +- maximum_level_override = (pa_log_level_t) atoi(e); ++ if (getenv(ENV_LOG_SYSLOG)) { ++ target_override = PA_LOG_SYSLOG; ++ target_override_set = TRUE; ++ } + +- if (maximum_level_override >= PA_LOG_LEVEL_MAX) +- maximum_level_override = PA_LOG_LEVEL_MAX-1; +- } ++ if ((e = getenv(ENV_LOG_LEVEL))) { ++ maximum_level_override = (pa_log_level_t) atoi(e); + +- if (getenv(ENV_LOG_COLORS)) +- flags_override |= PA_LOG_COLORS; ++ if (maximum_level_override >= PA_LOG_LEVEL_MAX) ++ maximum_level_override = PA_LOG_LEVEL_MAX-1; ++ } + +- if (getenv(ENV_LOG_PRINT_TIME)) +- flags_override |= PA_LOG_PRINT_TIME; ++ if (getenv(ENV_LOG_COLORS)) ++ flags_override |= PA_LOG_COLORS; + +- if (getenv(ENV_LOG_PRINT_FILE)) +- flags_override |= PA_LOG_PRINT_FILE; ++ if (getenv(ENV_LOG_PRINT_TIME)) ++ flags_override |= PA_LOG_PRINT_TIME; + +- if (getenv(ENV_LOG_PRINT_META)) +- flags_override |= PA_LOG_PRINT_META; ++ if (getenv(ENV_LOG_PRINT_FILE)) ++ flags_override |= PA_LOG_PRINT_FILE; + +- if (getenv(ENV_LOG_PRINT_LEVEL)) +- flags_override |= PA_LOG_PRINT_LEVEL; ++ if (getenv(ENV_LOG_PRINT_META)) ++ flags_override |= PA_LOG_PRINT_META; + +- if ((e = getenv(ENV_LOG_BACKTRACE))) { +- show_backtrace_override = (unsigned) atoi(e); ++ if (getenv(ENV_LOG_PRINT_LEVEL)) ++ flags_override |= PA_LOG_PRINT_LEVEL; + +- if (show_backtrace_override <= 0) +- show_backtrace_override = 0; +- } ++ if ((e = getenv(ENV_LOG_BACKTRACE))) { ++ show_backtrace_override = (unsigned) atoi(e); + +- if ((e = getenv(ENV_LOG_BACKTRACE_SKIP))) { +- skip_backtrace = (unsigned) atoi(e); ++ if (show_backtrace_override <= 0) ++ show_backtrace_override = 0; ++ } + +- if (skip_backtrace <= 0) +- skip_backtrace = 0; +- } ++ if ((e = getenv(ENV_LOG_BACKTRACE_SKIP))) { ++ skip_backtrace = (unsigned) atoi(e); ++ ++ if (skip_backtrace <= 0) ++ skip_backtrace = 0; ++ } ++ ++ if (getenv(ENV_LOG_NO_RATELIMIT)) ++ no_rate_limit = TRUE; ++ ++ } PA_ONCE_END; + } + + void pa_log_levelv_meta( +@@ -268,9 +277,7 @@ void pa_log_levelv_meta( + pa_assert(level < PA_LOG_LEVEL_MAX); + pa_assert(format); + +- PA_ONCE_BEGIN { +- init_defaults(); +- } PA_ONCE_END; ++ init_defaults(); + + _target = target_override_set ? target_override : target; + _maximum_level = PA_MAX(maximum_level, maximum_level_override); +@@ -428,5 +435,10 @@ pa_bool_t pa_log_ratelimit(void) { + /* Not more than 10 messages every 5s */ + static PA_DEFINE_RATELIMIT(ratelimit, 5 * PA_USEC_PER_SEC, 10); + ++ init_defaults(); ++ ++ if (no_rate_limit) ++ return TRUE; ++ + return pa_ratelimit_test(&ratelimit); + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0012-udev-make-sure-we-get-events-only-for-sound-devices.patch b/srcpkgs/pulseaudio/patches/0012-udev-make-sure-we-get-events-only-for-sound-devices.patch new file mode 100644 index 00000000000..37a21bd7b16 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0012-udev-make-sure-we-get-events-only-for-sound-devices.patch @@ -0,0 +1,28 @@ +From 9b37dce4223aaf7a5f48b04b52c89b46ad97cf73 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 13 Jan 2010 19:41:44 +0100 +Subject: [PATCH 12/62] udev: make sure we get events only for sound devices + +--- + src/modules/module-udev-detect.c | 5 +++++ + 1 files changed, 5 insertions(+), 0 deletions(-) + +diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c +index 7508d9a..58635a5 100644 +--- a/src/modules/module-udev-detect.c ++++ b/src/modules/module-udev-detect.c +@@ -639,6 +639,11 @@ int pa__init(pa_module *m) { + goto fail; + } + ++ if (udev_monitor_filter_add_match_subsystem_devtype(u->monitor, "sound", NULL) < 0) { ++ pa_log("Failed to subscribe to sound devices."); ++ goto fail; ++ } ++ + errno = 0; + if (udev_monitor_enable_receiving(u->monitor) < 0) { + pa_log("Failed to enable monitor: %s", pa_cstrerror(errno)); +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0013-alsa-ignore-volume-changes-from-the-hw-if-we-are-not.patch b/srcpkgs/pulseaudio/patches/0013-alsa-ignore-volume-changes-from-the-hw-if-we-are-not.patch new file mode 100644 index 00000000000..3b2c71c4126 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0013-alsa-ignore-volume-changes-from-the-hw-if-we-are-not.patch @@ -0,0 +1,41 @@ +From 540ec7b961256d6c7702448ca995f61268064190 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 13 Jan 2010 20:30:36 +0100 +Subject: [PATCH 13/62] alsa: ignore volume changes from the hw if we are not on the active console + +--- + src/modules/alsa/alsa-sink.c | 3 +++ + src/modules/alsa/alsa-source.c | 3 +++ + 2 files changed, 6 insertions(+), 0 deletions(-) + +diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c +index ed16c83..690480f 100644 +--- a/src/modules/alsa/alsa-sink.c ++++ b/src/modules/alsa/alsa-sink.c +@@ -1103,6 +1103,9 @@ static int mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) { + if (mask == SND_CTL_EVENT_MASK_REMOVE) + return 0; + ++ if (u->sink->suspend_cause & PA_SUSPEND_SESSION) ++ return 0; ++ + if (mask & SND_CTL_EVENT_MASK_VALUE) { + pa_sink_get_volume(u->sink, TRUE); + pa_sink_get_mute(u->sink, TRUE); +diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c +index 157698e..f8b583e 100644 +--- a/src/modules/alsa/alsa-source.c ++++ b/src/modules/alsa/alsa-source.c +@@ -1051,6 +1051,9 @@ static int mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) { + if (mask == SND_CTL_EVENT_MASK_REMOVE) + return 0; + ++ if (u->source->suspend_cause & PA_SUSPEND_SESSION) ++ return 0; ++ + if (mask & SND_CTL_EVENT_MASK_VALUE) { + pa_source_get_volume(u->source, TRUE); + pa_source_get_mute(u->source, TRUE); +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0014-cpu-check-for-CMOV-flag-before-using-this-intsructio.patch b/srcpkgs/pulseaudio/patches/0014-cpu-check-for-CMOV-flag-before-using-this-intsructio.patch new file mode 100644 index 00000000000..2ea4fa8cfdf --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0014-cpu-check-for-CMOV-flag-before-using-this-intsructio.patch @@ -0,0 +1,80 @@ +From 170812755e0ac235ed2b7182ef637eb317d8b2b2 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 13 Jan 2010 20:31:17 +0100 +Subject: [PATCH 14/62] cpu: check for CMOV flag before using this intsruction in assembly + +http://pulseaudio.org/ticket/776 +--- + src/pulsecore/cpu-x86.c | 6 +++++- + src/pulsecore/cpu-x86.h | 6 +++--- + src/pulsecore/svolume_mmx.c | 2 +- + 3 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/src/pulsecore/cpu-x86.c b/src/pulsecore/cpu-x86.c +index f194a60..b173072 100644 +--- a/src/pulsecore/cpu-x86.c ++++ b/src/pulsecore/cpu-x86.c +@@ -57,6 +57,9 @@ void pa_cpu_init_x86 (void) { + if (level >= 1) { + get_cpuid (0x00000001, &eax, &ebx, &ecx, &edx); + ++ if (edx & (1<<15)) ++ flags |= PA_CPU_X86_CMOV; ++ + if (edx & (1<<23)) + flags |= PA_CPU_X86_MMX; + +@@ -97,7 +100,8 @@ void pa_cpu_init_x86 (void) { + flags |= PA_CPU_X86_3DNOW; + } + +- pa_log_info ("CPU flags: %s%s%s%s%s%s%s%s%s%s", ++ pa_log_info ("CPU flags: %s%s%s%s%s%s%s%s%s%s%s", ++ (flags & PA_CPU_X86_CMOV) ? "CMOV " : "", + (flags & PA_CPU_X86_MMX) ? "MMX " : "", + (flags & PA_CPU_X86_SSE) ? "SSE " : "", + (flags & PA_CPU_X86_SSE2) ? "SSE2 " : "", +diff --git a/src/pulsecore/cpu-x86.h b/src/pulsecore/cpu-x86.h +index b40eb5c..285c203 100644 +--- a/src/pulsecore/cpu-x86.h ++++ b/src/pulsecore/cpu-x86.h +@@ -5,7 +5,7 @@ + This file is part of PulseAudio. + + Copyright 2004-2006 Lennart Poettering +- Copyright 2009 Wim Taymans ++ Copyright 2009 Wim Taymans + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published +@@ -35,12 +35,12 @@ typedef enum pa_cpu_x86_flag { + PA_CPU_X86_SSE4_1 = (1 << 6), + PA_CPU_X86_SSE4_2 = (1 << 7), + PA_CPU_X86_3DNOW = (1 << 8), +- PA_CPU_X86_3DNOWEXT = (1 << 9) ++ PA_CPU_X86_3DNOWEXT = (1 << 9), ++ PA_CPU_X86_CMOV = (1 << 10) + } pa_cpu_x86_flag_t; + + void pa_cpu_init_x86 (void); + +- + #if defined (__i386__) + typedef int32_t pa_reg_x86; + #define PA_REG_a "eax" +diff --git a/src/pulsecore/svolume_mmx.c b/src/pulsecore/svolume_mmx.c +index 46923ed..e50ebee 100644 +--- a/src/pulsecore/svolume_mmx.c ++++ b/src/pulsecore/svolume_mmx.c +@@ -305,7 +305,7 @@ void pa_volume_func_init_mmx (pa_cpu_x86_flag_t flags) { + run_test (); + #endif + +- if (flags & PA_CPU_X86_MMX) { ++ if ((flags & PA_CPU_X86_MMX) && (flags & PA_CPU_X86_CMOV)) { + pa_log_info("Initialising MMX optimized functions."); + + pa_set_volume_func (PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_mmx); +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0015-alsa-cover-Input-Source-Int-Mic.patch b/srcpkgs/pulseaudio/patches/0015-alsa-cover-Input-Source-Int-Mic.patch new file mode 100644 index 00000000000..2526026e353 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0015-alsa-cover-Input-Source-Int-Mic.patch @@ -0,0 +1,29 @@ +From 67c6535222508bd84a122860023a8dc7fd44cd35 Mon Sep 17 00:00:00 2001 +From: Colin Guthrie +Date: Wed, 13 Jan 2010 23:44:00 +0000 +Subject: [PATCH 15/62] alsa: cover Input Source:Int Mic + +As seen on some HDA chips (e.g. Fujitsu Siemens S6410) +Refs http://pulseaudio.org/ticket/772 +--- + .../alsa/mixer/paths/analog-input.conf.common | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/src/modules/alsa/mixer/paths/analog-input.conf.common b/src/modules/alsa/mixer/paths/analog-input.conf.common +index 951e11f..fbdc8fb 100644 +--- a/src/modules/alsa/mixer/paths/analog-input.conf.common ++++ b/src/modules/alsa/mixer/paths/analog-input.conf.common +@@ -78,6 +78,10 @@ priority = 19 + name = input-microphone + priority = 19 + ++[Option Input Source:Int Mic] ++name = input-microphone ++priority = 19 ++ + [Option Input Source:Internal Mic] + name = input-microphone + priority = 19 +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0016-alsa-Cover-the-Int-Mic-Boost-element.patch b/srcpkgs/pulseaudio/patches/0016-alsa-Cover-the-Int-Mic-Boost-element.patch new file mode 100644 index 00000000000..89d269c3b46 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0016-alsa-Cover-the-Int-Mic-Boost-element.patch @@ -0,0 +1,36 @@ +From 291cd096015d540d5064bfae94a66adc3bc3fc64 Mon Sep 17 00:00:00 2001 +From: Colin Guthrie +Date: Wed, 13 Jan 2010 23:47:21 +0000 +Subject: [PATCH 16/62] alsa: Cover the 'Int Mic Boost' element. + +This is not 100% ideal as we have not way to tie specific boosts to specific +inputs and this particular chipset (as noted in #772) appears to +support just that. + +For the time being incorporate it into the normal boost logic. + +See http://pulseaudio.org/ticket/772 +--- + .../alsa/mixer/paths/analog-input-mic.conf.common | 9 +++++++++ + 1 files changed, 9 insertions(+), 0 deletions(-) + +diff --git a/src/modules/alsa/mixer/paths/analog-input-mic.conf.common b/src/modules/alsa/mixer/paths/analog-input-mic.conf.common +index b35e7af..4663305 100644 +--- a/src/modules/alsa/mixer/paths/analog-input-mic.conf.common ++++ b/src/modules/alsa/mixer/paths/analog-input-mic.conf.common +@@ -61,3 +61,12 @@ name = input-boost-on + + [Option Front Mic Boost:off] + name = input-boost-off ++ ++[Element Int Mic Boost] ++switch = select ++ ++[Option Int Mic Boost:on] ++name = input-boost-on ++ ++[Option Int Mic Boost:off] ++name = input-boost-off +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0017-udev-handle-sound-cards-with-both-modem-and-audio-pr.patch b/srcpkgs/pulseaudio/patches/0017-udev-handle-sound-cards-with-both-modem-and-audio-pr.patch new file mode 100644 index 00000000000..1ed41c5057a --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0017-udev-handle-sound-cards-with-both-modem-and-audio-pr.patch @@ -0,0 +1,117 @@ +From 63c968bf775ec7e172b89e45ddc4981d79587bc5 Mon Sep 17 00:00:00 2001 +From: Daniel T. Chen +Date: Thu, 14 Jan 2010 00:57:27 +0100 +Subject: [PATCH 17/62] udev: handle sound cards with both modem and audio properly + +http://pulseaudio.org/ticket/681 +https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/394500 +--- + src/modules/module-udev-detect.c | 59 ++++++++++++++++++++++++++++++++++++-- + 1 files changed, 56 insertions(+), 3 deletions(-) + +diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c +index 58635a5..1fe9fdc 100644 +--- a/src/modules/module-udev-detect.c ++++ b/src/modules/module-udev-detect.c +@@ -103,13 +103,17 @@ static const char *path_get_card_id(const char *path) { + return e + 5; + } + ++static const char *pa_udev_get_sysattr(const char *card_idx, const char *name); ++ + static pa_bool_t is_card_busy(const char *id) { +- char *card_path = NULL, *pcm_path = NULL, *sub_status = NULL; ++ const char *pcm_class; ++ char *card_path = NULL, *pcm_path = NULL, *sub_status = NULL, ++ *sysfs_path = NULL; + DIR *card_dir = NULL, *pcm_dir = NULL; + FILE *status_file = NULL; + size_t len; + struct dirent *space = NULL, *de; +- pa_bool_t busy = FALSE; ++ pa_bool_t busy = FALSE, is_modem = FALSE; + int r; + + pa_assert(id); +@@ -127,6 +131,17 @@ static pa_bool_t is_card_busy(const char *id) { + len = offsetof(struct dirent, d_name) + fpathconf(dirfd(card_dir), _PC_NAME_MAX) + 1; + space = pa_xmalloc(len); + ++ /* Also check /sys/class/sound/card.../pcmC...D6p/pcm_class. An HDA ++ * modem can be used simultaneously with generic playback/record. */ ++ ++ pa_xfree(sysfs_path); ++ sysfs_path = pa_sprintf_malloc("pcmC%sD6p/pcm_class", id); ++ ++ pcm_class = pa_udev_get_sysattr(id, sysfs_path); ++ ++ if (pcm_class && pa_streq(pcm_class, "modem")) ++ is_modem = TRUE; ++ + for (;;) { + de = NULL; + +@@ -182,7 +197,7 @@ static pa_bool_t is_card_busy(const char *id) { + continue; + } + +- if (!pa_streq(line, "closed\n")) { ++ if (!is_modem && !pa_streq(line, "closed\n")) { + busy = TRUE; + break; + } +@@ -193,6 +208,7 @@ fail: + + pa_xfree(card_path); + pa_xfree(pcm_path); ++ pa_xfree(sysfs_path); + pa_xfree(sub_status); + pa_xfree(space); + +@@ -594,6 +610,43 @@ static int setup_inotify(struct userdata *u) { + return 0; + } + ++static const char *pa_udev_get_sysattr(const char *card_idx, const char *name) { ++ struct udev *udev; ++ struct udev_device *card = NULL; ++ char *t, *r = NULL; ++ const char *v; ++ ++ pa_assert(card_idx); ++ pa_assert(name); ++ ++ if (!(udev = udev_new())) { ++ pa_log_error("Failed to allocate udev context."); ++ goto finish; ++ } ++ ++ t = pa_sprintf_malloc("%s/class/sound/card%s", udev_get_sys_path(udev), card_idx); ++ card = udev_device_new_from_syspath(udev, t); ++ pa_xfree(t); ++ ++ if (!card) { ++ pa_log_error("Failed to get card object."); ++ goto finish; ++ } ++ ++ if ((v = udev_device_get_sysattr_value(card, name)) && *v) ++ r = pa_xstrdup(v); ++ ++finish: ++ ++ if (card) ++ udev_device_unref(card); ++ ++ if (udev) ++ udev_unref(udev); ++ ++ return r; ++} ++ + int pa__init(pa_module *m) { + struct userdata *u = NULL; + pa_modargs *ma; +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0018-udev-rework-modem-detection-a-bit.patch b/srcpkgs/pulseaudio/patches/0018-udev-rework-modem-detection-a-bit.patch new file mode 100644 index 00000000000..8e45a4b1a40 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0018-udev-rework-modem-detection-a-bit.patch @@ -0,0 +1,182 @@ +From acb4996203f6723d92a9b0df4e60db83c65116fc Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 14 Jan 2010 02:06:52 +0100 +Subject: [PATCH 18/62] udev: rework modem detection a bit + +Check every single pcm device of a card whether it is a modem. +--- + src/modules/module-udev-detect.c | 117 ++++++++++++++++++++------------------ + 1 files changed, 62 insertions(+), 55 deletions(-) + +diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c +index 1fe9fdc..b8568b2 100644 +--- a/src/modules/module-udev-detect.c ++++ b/src/modules/module-udev-detect.c +@@ -103,17 +103,70 @@ static const char *path_get_card_id(const char *path) { + return e + 5; + } + +-static const char *pa_udev_get_sysattr(const char *card_idx, const char *name); ++static char *card_get_sysattr(const char *card_idx, const char *name) { ++ struct udev *udev; ++ struct udev_device *card = NULL; ++ char *t, *r = NULL; ++ const char *v; ++ ++ pa_assert(card_idx); ++ pa_assert(name); ++ ++ if (!(udev = udev_new())) { ++ pa_log_error("Failed to allocate udev context."); ++ goto finish; ++ } ++ ++ t = pa_sprintf_malloc("%s/class/sound/card%s", udev_get_sys_path(udev), card_idx); ++ card = udev_device_new_from_syspath(udev, t); ++ pa_xfree(t); ++ ++ if (!card) { ++ pa_log_error("Failed to get card object."); ++ goto finish; ++ } ++ ++ if ((v = udev_device_get_sysattr_value(card, name)) && *v) ++ r = pa_xstrdup(v); ++ ++finish: ++ ++ if (card) ++ udev_device_unref(card); ++ ++ if (udev) ++ udev_unref(udev); ++ ++ return r; ++} ++ ++static pa_bool_t pcm_is_modem(const char *card_idx, const char *pcm) { ++ char *sysfs_path, *pcm_class; ++ pa_bool_t is_modem; ++ ++ pa_assert(card_idx); ++ pa_assert(pcm); ++ ++ /* Check /sys/class/sound/card.../pcmC...../pcm_class. An HDA ++ * modem can be used simultaneously with generic ++ * playback/record. */ ++ ++ sysfs_path = pa_sprintf_malloc("pcmC%sD%s/pcm_class", card_idx, pcm); ++ pcm_class = card_get_sysattr(card_idx, sysfs_path); ++ is_modem = pcm_class && pa_streq(pcm_class, "modem"); ++ pa_xfree(pcm_class); ++ pa_xfree(sysfs_path); ++ ++ return is_modem; ++} + + static pa_bool_t is_card_busy(const char *id) { +- const char *pcm_class; +- char *card_path = NULL, *pcm_path = NULL, *sub_status = NULL, +- *sysfs_path = NULL; ++ char *card_path = NULL, *pcm_path = NULL, *sub_status = NULL; + DIR *card_dir = NULL, *pcm_dir = NULL; + FILE *status_file = NULL; + size_t len; + struct dirent *space = NULL, *de; +- pa_bool_t busy = FALSE, is_modem = FALSE; ++ pa_bool_t busy = FALSE; + int r; + + pa_assert(id); +@@ -131,17 +184,6 @@ static pa_bool_t is_card_busy(const char *id) { + len = offsetof(struct dirent, d_name) + fpathconf(dirfd(card_dir), _PC_NAME_MAX) + 1; + space = pa_xmalloc(len); + +- /* Also check /sys/class/sound/card.../pcmC...D6p/pcm_class. An HDA +- * modem can be used simultaneously with generic playback/record. */ +- +- pa_xfree(sysfs_path); +- sysfs_path = pa_sprintf_malloc("pcmC%sD6p/pcm_class", id); +- +- pcm_class = pa_udev_get_sysattr(id, sysfs_path); +- +- if (pcm_class && pa_streq(pcm_class, "modem")) +- is_modem = TRUE; +- + for (;;) { + de = NULL; + +@@ -156,6 +198,9 @@ static pa_bool_t is_card_busy(const char *id) { + if (!pa_startswith(de->d_name, "pcm")) + continue; + ++ if (pcm_is_modem(id, de->d_name + 3)) ++ continue; ++ + pa_xfree(pcm_path); + pcm_path = pa_sprintf_malloc("%s/%s", card_path, de->d_name); + +@@ -197,7 +242,7 @@ static pa_bool_t is_card_busy(const char *id) { + continue; + } + +- if (!is_modem && !pa_streq(line, "closed\n")) { ++ if (!pa_streq(line, "closed\n")) { + busy = TRUE; + break; + } +@@ -208,7 +253,6 @@ fail: + + pa_xfree(card_path); + pa_xfree(pcm_path); +- pa_xfree(sysfs_path); + pa_xfree(sub_status); + pa_xfree(space); + +@@ -610,43 +654,6 @@ static int setup_inotify(struct userdata *u) { + return 0; + } + +-static const char *pa_udev_get_sysattr(const char *card_idx, const char *name) { +- struct udev *udev; +- struct udev_device *card = NULL; +- char *t, *r = NULL; +- const char *v; +- +- pa_assert(card_idx); +- pa_assert(name); +- +- if (!(udev = udev_new())) { +- pa_log_error("Failed to allocate udev context."); +- goto finish; +- } +- +- t = pa_sprintf_malloc("%s/class/sound/card%s", udev_get_sys_path(udev), card_idx); +- card = udev_device_new_from_syspath(udev, t); +- pa_xfree(t); +- +- if (!card) { +- pa_log_error("Failed to get card object."); +- goto finish; +- } +- +- if ((v = udev_device_get_sysattr_value(card, name)) && *v) +- r = pa_xstrdup(v); +- +-finish: +- +- if (card) +- udev_device_unref(card); +- +- if (udev) +- udev_unref(udev); +- +- return r; +-} +- + int pa__init(pa_module *m) { + struct userdata *u = NULL; + pa_modargs *ma; +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0019-daemon-first-take-name-on-the-bus-then-return-in-sta.patch b/srcpkgs/pulseaudio/patches/0019-daemon-first-take-name-on-the-bus-then-return-in-sta.patch new file mode 100644 index 00000000000..2315a30dc73 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0019-daemon-first-take-name-on-the-bus-then-return-in-sta.patch @@ -0,0 +1,39 @@ +From 93cb75d78ed82c40e525a8b30f1ead147ad35ead Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 14 Jan 2010 02:33:49 +0100 +Subject: [PATCH 19/62] daemon: first take name on the bus, then return in starter process + +http://pulseaudio.org/ticket/748 +--- + src/daemon/main.c | 8 ++++---- + 1 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/daemon/main.c b/src/daemon/main.c +index eafd72a..c7e202a 100644 +--- a/src/daemon/main.c ++++ b/src/daemon/main.c +@@ -952,6 +952,10 @@ int main(int argc, char *argv[]) { + goto finish; + } + ++#ifdef HAVE_DBUS ++ dbus = register_dbus(c); ++#endif ++ + #ifdef HAVE_FORK + if (daemon_pipe[1] >= 0) { + int ok = 0; +@@ -961,10 +965,6 @@ int main(int argc, char *argv[]) { + } + #endif + +-#ifdef HAVE_DBUS +- dbus = register_dbus(c); +-#endif +- + pa_log_info(_("Daemon startup complete.")); + + retval = 0; +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0020-alsa-cover-bass-boost-mixer-element.patch b/srcpkgs/pulseaudio/patches/0020-alsa-cover-bass-boost-mixer-element.patch new file mode 100644 index 00000000000..8ba6278976a --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0020-alsa-cover-bass-boost-mixer-element.patch @@ -0,0 +1,49 @@ +From 48e0f6808bcc8e07622e4a45b3aabfc4679e9966 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 14 Jan 2010 02:53:50 +0100 +Subject: [PATCH 20/62] alsa: cover bass boost mixer element + +http://pulseaudio.org/ticket/740 +--- + src/modules/alsa/alsa-mixer.c | 2 ++ + .../alsa/mixer/paths/analog-output.conf.common | 11 +++++++++++ + 2 files changed, 13 insertions(+), 0 deletions(-) + +diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c +index 8b13239..8bbd1f5 100644 +--- a/src/modules/alsa/alsa-mixer.c ++++ b/src/modules/alsa/alsa-mixer.c +@@ -1713,6 +1713,8 @@ static int option_verify(pa_alsa_option *o) { + { "input-boost-off", N_("No Boost") }, + { "output-amplifier-on", N_("Amplifier") }, + { "output-amplifier-off", N_("No Amplifier") }, ++ { "output-bass-boost-on", N_("Bass Boost") }, ++ { "output-bass-boost-off", N_("No Bass Boost") }, + { "output-speaker", N_("Speaker") }, + { "output-headphones", N_("Headphones") } + }; +diff --git a/src/modules/alsa/mixer/paths/analog-output.conf.common b/src/modules/alsa/mixer/paths/analog-output.conf.common +index fd7f0cf..6131da5 100644 +--- a/src/modules/alsa/mixer/paths/analog-output.conf.common ++++ b/src/modules/alsa/mixer/paths/analog-output.conf.common +@@ -110,6 +110,17 @@ priority = 10 + name = output-amplifier-off + priority = 0 + ++[Element Bass Boost] ++switch = select ++ ++[Option Bass Boost:on] ++name = output-bass-boost-on ++priority = 0 ++ ++[Option Bass Boost:off] ++name = output-bass-boost-off ++priority = 10 ++ + ;;; 'Analog Output' + + [Element Analog Output] +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0021-Mark-shared-variables-as-volatile.patch b/srcpkgs/pulseaudio/patches/0021-Mark-shared-variables-as-volatile.patch new file mode 100644 index 00000000000..cfce6b6957e --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0021-Mark-shared-variables-as-volatile.patch @@ -0,0 +1,55 @@ +From 366e6d7e90d3bebc98a1af3cfb04b4cfc8cff6f5 Mon Sep 17 00:00:00 2001 +From: Arun Raghavan +Date: Sun, 6 Dec 2009 12:20:53 +0530 +Subject: [PATCH 21/62] Mark shared variables as volatile + +'n_waiting' and 'n_waiting_for_accept' may be accessed from mulitple +threads, and thus need to be marked as volatile to suppres certain +compiler optimisations. All uses are protected by a mutex, so we don't +need to worry about cache issues (added documentation for this as well). + +This addresses bug #738. +--- + src/pulse/thread-mainloop.c | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c +index a2b98ce..14ed926 100644 +--- a/src/pulse/thread-mainloop.c ++++ b/src/pulse/thread-mainloop.c +@@ -51,7 +51,7 @@ + + struct pa_threaded_mainloop { + pa_mainloop *real_mainloop; +- int n_waiting, n_waiting_for_accept; ++ volatile int n_waiting, n_waiting_for_accept; + + pa_thread* thread; + pa_mutex* mutex; +@@ -185,6 +185,7 @@ void pa_threaded_mainloop_unlock(pa_threaded_mainloop *m) { + pa_mutex_unlock(m->mutex); + } + ++/* Called with the lock taken */ + void pa_threaded_mainloop_signal(pa_threaded_mainloop *m, int wait_for_accept) { + pa_assert(m); + +@@ -198,6 +199,7 @@ void pa_threaded_mainloop_signal(pa_threaded_mainloop *m, int wait_for_accept) { + } + } + ++/* Called with the lock taken */ + void pa_threaded_mainloop_wait(pa_threaded_mainloop *m) { + pa_assert(m); + +@@ -212,6 +214,7 @@ void pa_threaded_mainloop_wait(pa_threaded_mainloop *m) { + m->n_waiting --; + } + ++/* Called with the lock taken */ + void pa_threaded_mainloop_accept(pa_threaded_mainloop *m) { + pa_assert(m); + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0022-udev-use-ID_MODEL_ENC-instead-of-ID_MODEL-if-it-is-s.patch b/srcpkgs/pulseaudio/patches/0022-udev-use-ID_MODEL_ENC-instead-of-ID_MODEL-if-it-is-s.patch new file mode 100644 index 00000000000..cd7a9687858 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0022-udev-use-ID_MODEL_ENC-instead-of-ID_MODEL-if-it-is-s.patch @@ -0,0 +1,153 @@ +From e129f8577a405266a5b7d4a7ee75bd56dd43953e Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 14 Jan 2010 20:31:00 +0100 +Subject: [PATCH 22/62] udev: use ID_MODEL_ENC instead of ID_MODEL if it is set + +That way we should be able to make use of the nicer USB strings the USB +hw provides. + +Fixes the issues pointed out in: + +https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-January/006248.html +--- + src/modules/udev-util.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++ + 1 files changed, 110 insertions(+), 0 deletions(-) + +diff --git a/src/modules/udev-util.c b/src/modules/udev-util.c +index cc82446..eee5409 100644 +--- a/src/modules/udev-util.c ++++ b/src/modules/udev-util.c +@@ -58,6 +58,112 @@ static int read_id(struct udev_device *d, const char *n) { + return u; + } + ++static int dehex(char x) { ++ if (x >= '0' && x <= '9') ++ return x - '0'; ++ ++ if (x >= 'A' && x <= 'F') ++ return x - 'A'; ++ ++ if (x >= 'a' && x <= 'f') ++ return x - 'a'; ++ ++ return -1; ++} ++ ++static void proplist_sets_unescape(pa_proplist *p, const char *prop, const char *s) { ++ const char *f; ++ char *t, *r; ++ int c; ++ ++ enum { ++ TEXT, ++ BACKSLASH, ++ EX, ++ FIRST ++ } state = TEXT; ++ ++ /* The resulting string is definitely shorter than the source string */ ++ r = pa_xnew(char, strlen(s)+1); ++ ++ for (f = s, t = r; *f; f++) { ++ ++ switch (state) { ++ ++ case TEXT: ++ if (*f == '\\') ++ state = BACKSLASH; ++ else ++ *(t++) = *f; ++ break; ++ ++ case BACKSLASH: ++ if (*f == 'x') ++ state = EX; ++ else { ++ *(t++) = '\\'; ++ *(t++) = *f; ++ state = TEXT; ++ } ++ break; ++ ++ case EX: ++ c = dehex(*f); ++ ++ if (c < 0) { ++ *(t++) = '\\'; ++ *(t++) = 'x'; ++ *(t++) = *f; ++ state = TEXT; ++ } else ++ state = FIRST; ++ ++ break; ++ ++ case FIRST: { ++ int d = dehex(*f); ++ ++ if (d < 0) { ++ *(t++) = '\\'; ++ *(t++) = 'x'; ++ *(t++) = *(f-1); ++ *(t++) = *f; ++ } else ++ *(t++) = (char) (c << 4) | d; ++ ++ state = TEXT; ++ break; ++ } ++ } ++ } ++ ++ switch (state) { ++ ++ case TEXT: ++ break; ++ ++ case BACKSLASH: ++ *(t++) = '\\'; ++ break; ++ ++ case EX: ++ *(t++) = '\\'; ++ *(t++) = 'x'; ++ break; ++ ++ case FIRST: ++ *(t++) = '\\'; ++ *(t++) = 'x'; ++ *(t++) = *(f-1); ++ break; ++ } ++ ++ *t = 0; ++ ++ pa_proplist_sets(p, prop, r); ++ pa_xfree(r); ++} ++ + int pa_udev_get_info(int card_idx, pa_proplist *p) { + int r = -1; + struct udev *udev; +@@ -107,6 +213,8 @@ int pa_udev_get_info(int card_idx, pa_proplist *p) { + if (!pa_proplist_contains(p, PA_PROP_DEVICE_VENDOR_NAME)) { + if ((v = udev_device_get_property_value(card, "ID_VENDOR_FROM_DATABASE")) && *v) + pa_proplist_sets(p, PA_PROP_DEVICE_VENDOR_NAME, v); ++ else if ((v = udev_device_get_property_value(card, "ID_VENDOR_ENC")) && *v) ++ proplist_sets_unescape(p, PA_PROP_DEVICE_VENDOR_NAME, v); + else if ((v = udev_device_get_property_value(card, "ID_VENDOR")) && *v) + pa_proplist_sets(p, PA_PROP_DEVICE_VENDOR_NAME, v); + } +@@ -118,6 +226,8 @@ int pa_udev_get_info(int card_idx, pa_proplist *p) { + if (!pa_proplist_contains(p, PA_PROP_DEVICE_PRODUCT_NAME)) { + if ((v = udev_device_get_property_value(card, "ID_MODEL_FROM_DATABASE")) && *v) + pa_proplist_sets(p, PA_PROP_DEVICE_PRODUCT_NAME, v); ++ else if ((v = udev_device_get_property_value(card, "ID_MODEL_ENC")) && *v) ++ proplist_sets_unescape(p, PA_PROP_DEVICE_PRODUCT_NAME, v); + else if ((v = udev_device_get_property_value(card, "ID_MODEL")) && *v) + pa_proplist_sets(p, PA_PROP_DEVICE_PRODUCT_NAME, v); + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0023-pacat-allow-configuration-of-latency-in-msec.patch b/srcpkgs/pulseaudio/patches/0023-pacat-allow-configuration-of-latency-in-msec.patch new file mode 100644 index 00000000000..5cf591475d8 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0023-pacat-allow-configuration-of-latency-in-msec.patch @@ -0,0 +1,268 @@ +From 27df02779a26e0356497a39bee04a28138ba52af Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 15 Jan 2010 01:25:21 +0100 +Subject: [PATCH 23/62] pacat: allow configuration of latency in msec + +--- + man/pacat.1.xml.in | 96 +++++++++++++++++++++++++++++++++++++++++++-------- + src/utils/pacat.c | 46 ++++++++++++++++++++----- + 2 files changed, 118 insertions(+), 24 deletions(-) + +diff --git a/man/pacat.1.xml.in b/man/pacat.1.xml.in +index 68a3a12..2e27450 100644 +--- a/man/pacat.1.xml.in ++++ b/man/pacat.1.xml.in +@@ -21,18 +21,22 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. + --> + +- ++ + + ++ paplay [options] [FILE] ++ parecord [options] [FILE] + pacat [options] [FILE] + parec [options] [FILE] +- paplay --help +- paplay --version ++ pamon [options] [FILE] ++ pacat --help ++ pacat --version + + + +

pacat is a simple tool for playing back or +- capturing raw audio files on a PulseAudio sound server.

++ capturing raw or encoded audio files on a PulseAudio sound ++ server.

+
+ + +@@ -52,13 +56,13 @@ USA. + + + + + + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + +
+@@ -178,7 +244,7 @@ USA. + +
+

+- , ++ , +

+
+ +diff --git a/src/utils/pacat.c b/src/utils/pacat.c +index 5f29ba3..a5d2e9a 100644 +--- a/src/utils/pacat.c ++++ b/src/utils/pacat.c +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + + #define TIME_EVENT_USEC 50000 + +@@ -86,6 +87,7 @@ static sf_count_t (*writef_function)(SNDFILE *_sndfile, const void *ptr, sf_coun + static pa_stream_flags_t flags = 0; + + static size_t latency = 0, process_time = 0; ++static int32_t latency_msec = 0, process_time_msec = 0; + + static pa_bool_t raw = TRUE; + static int file_format = -1; +@@ -434,19 +436,25 @@ static void context_state_callback(pa_context *c, void *userdata) { + buffer_attr.maxlength = (uint32_t) -1; + buffer_attr.prebuf = (uint32_t) -1; + +- if (latency > 0) { ++ if (latency_msec > 0) { ++ buffer_attr.fragsize = buffer_attr.tlength = pa_usec_to_bytes(latency_msec * PA_USEC_PER_MSEC, &sample_spec); ++ flags |= PA_STREAM_ADJUST_LATENCY; ++ } else if (latency > 0) { + buffer_attr.fragsize = buffer_attr.tlength = (uint32_t) latency; +- buffer_attr.minreq = (uint32_t) process_time; + flags |= PA_STREAM_ADJUST_LATENCY; +- } else { +- buffer_attr.tlength = (uint32_t) -1; ++ } else ++ buffer_attr.fragsize = buffer_attr.tlength = (uint32_t) -1; ++ ++ if (process_time_msec > 0) { ++ buffer_attr.minreq = pa_usec_to_bytes(process_time_msec * PA_USEC_PER_MSEC, &sample_spec); ++ } else if (process_time > 0) ++ buffer_attr.minreq = (uint32_t) process_time; ++ else + buffer_attr.minreq = (uint32_t) -1; +- buffer_attr.fragsize = (uint32_t) -1; +- } + + if (mode == PLAYBACK) { + pa_cvolume cv; +- if (pa_stream_connect_playback(stream, device, latency > 0 ? &buffer_attr : NULL, flags, volume_is_set ? pa_cvolume_set(&cv, sample_spec.channels, volume) : NULL, NULL) < 0) { ++ if (pa_stream_connect_playback(stream, device, &buffer_attr, flags, volume_is_set ? pa_cvolume_set(&cv, sample_spec.channels, volume) : NULL, NULL) < 0) { + pa_log(_("pa_stream_connect_playback() failed: %s"), pa_strerror(pa_context_errno(c))); + goto fail; + } +@@ -634,9 +642,11 @@ static void help(const char *argv0) { + " --no-remap Map channels by index instead of name.\n" + " --latency=BYTES Request the specified latency in bytes.\n" + " --process-time=BYTES Request the specified process time per request in bytes.\n" ++ " --latency-msec=MSEC Request the specified latency in msec.\n" ++ " --process-time-msec=MSEC Request the specified process time per request in msec.\n" + " --property=PROPERTY=VALUE Set the specified property to the specified value.\n" + " --raw Record/play raw PCM data.\n" +- " --file-format=FFORMAT Record/play formatted PCM data.\n" ++ " --file-format[=FFORMAT] Record/play formatted PCM data.\n" + " --list-file-formats List available file formats.\n") + , argv0); + } +@@ -659,7 +669,9 @@ enum { + ARG_RAW, + ARG_PROPERTY, + ARG_FILE_FORMAT, +- ARG_LIST_FILE_FORMATS ++ ARG_LIST_FILE_FORMATS, ++ ARG_LATENCY_MSEC, ++ ARG_PROCESS_TIME_MSEC + }; + + int main(int argc, char *argv[]) { +@@ -695,6 +707,8 @@ int main(int argc, char *argv[]) { + {"raw", 0, NULL, ARG_RAW}, + {"file-format", 2, NULL, ARG_FILE_FORMAT}, + {"list-file-formats", 0, NULL, ARG_LIST_FILE_FORMATS}, ++ {"latency-msec", 1, NULL, ARG_LATENCY_MSEC}, ++ {"process-time-msec", 1, NULL, ARG_PROCESS_TIME_MSEC}, + {NULL, 0, NULL, 0} + }; + +@@ -854,6 +868,20 @@ int main(int argc, char *argv[]) { + } + break; + ++ case ARG_LATENCY_MSEC: ++ if (((latency_msec = (int32_t) atoi(optarg))) <= 0) { ++ pa_log(_("Invalid latency specification '%s'"), optarg); ++ goto quit; ++ } ++ break; ++ ++ case ARG_PROCESS_TIME_MSEC: ++ if (((process_time_msec = (int32_t) atoi(optarg))) <= 0) { ++ pa_log(_("Invalid process time specification '%s'"), optarg); ++ goto quit; ++ } ++ break; ++ + case ARG_PROPERTY: { + char *t; + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0024-client-implement-PULSE_LATENCY_MSEC.patch b/srcpkgs/pulseaudio/patches/0024-client-implement-PULSE_LATENCY_MSEC.patch new file mode 100644 index 00000000000..37cb5d1f3b9 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0024-client-implement-PULSE_LATENCY_MSEC.patch @@ -0,0 +1,107 @@ +From fa64230107bd348ceda271dc9db74765c694d311 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 15 Jan 2010 01:25:42 +0100 +Subject: [PATCH 24/62] client: implement $PULSE_LATENCY_MSEC + +This allows easy overriding of a clients latency setting for debugging +purposes. + +http://pulseaudio.org/ticket/753 +--- + src/pulse/stream.c | 37 +++++++++++++++++++++++++++++++------ + 1 files changed, 31 insertions(+), 6 deletions(-) + +diff --git a/src/pulse/stream.c b/src/pulse/stream.c +index 79b2868..daeb53a 100644 +--- a/src/pulse/stream.c ++++ b/src/pulse/stream.c +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + + #include "fork-detect.h" + #include "internal.h" +@@ -855,10 +856,28 @@ static void create_stream_complete(pa_stream *s) { + check_smoother_status(s, TRUE, FALSE, FALSE); + } + +-static void automatic_buffer_attr(pa_stream *s, pa_buffer_attr *attr, const pa_sample_spec *ss) { ++static void patch_buffer_attr(pa_stream *s, pa_buffer_attr *attr, pa_stream_flags_t *flags) { ++ const char *e; ++ + pa_assert(s); + pa_assert(attr); +- pa_assert(ss); ++ ++ if ((e = getenv("PULSE_LATENCY_MSEC"))) { ++ uint32_t ms; ++ ++ if (pa_atou(e, &ms) < 0 || ms <= 0) ++ pa_log_debug("Failed to parse $PULSE_LATENCY_MSEC: %s", e); ++ else { ++ attr->maxlength = (uint32_t) -1; ++ attr->tlength = pa_usec_to_bytes(ms * PA_USEC_PER_MSEC, &s->sample_spec); ++ attr->minreq = (uint32_t) -1; ++ attr->prebuf = (uint32_t) -1; ++ attr->fragsize = attr->tlength; ++ } ++ ++ if (flags) ++ *flags |= PA_STREAM_ADJUST_LATENCY; ++ } + + if (s->context->version >= 13) + return; +@@ -873,7 +892,7 @@ static void automatic_buffer_attr(pa_stream *s, pa_buffer_attr *attr, const pa_s + attr->maxlength = 4*1024*1024; /* 4MB is the maximum queue length PulseAudio <= 0.9.9 supported. */ + + if (attr->tlength == (uint32_t) -1) +- attr->tlength = (uint32_t) pa_usec_to_bytes(250*PA_USEC_PER_MSEC, ss); /* 250ms of buffering */ ++ attr->tlength = (uint32_t) pa_usec_to_bytes(250*PA_USEC_PER_MSEC, &s->sample_spec); /* 250ms of buffering */ + + if (attr->minreq == (uint32_t) -1) + attr->minreq = (attr->tlength)/5; /* Ask for more data when there are only 200ms left in the playback buffer */ +@@ -1064,15 +1083,16 @@ static int create_stream( + pa_stream_ref(s); + + s->direction = direction; +- s->flags = flags; +- s->corked = !!(flags & PA_STREAM_START_CORKED); + + if (sync_stream) + s->syncid = sync_stream->syncid; + + if (attr) + s->buffer_attr = *attr; +- automatic_buffer_attr(s, &s->buffer_attr, &s->sample_spec); ++ patch_buffer_attr(s, &s->buffer_attr, &flags); ++ ++ s->flags = flags; ++ s->corked = !!(flags & PA_STREAM_START_CORKED); + + if (flags & PA_STREAM_INTERPOLATE_TIMING) { + pa_usec_t x; +@@ -2412,6 +2432,7 @@ pa_operation* pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr + pa_operation *o; + pa_tagstruct *t; + uint32_t tag; ++ pa_buffer_attr copy; + + pa_assert(s); + pa_assert(PA_REFCNT_VALUE(s) >= 1); +@@ -2435,6 +2456,10 @@ pa_operation* pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr + &tag); + pa_tagstruct_putu32(t, s->channel); + ++ copy = *attr; ++ patch_buffer_attr(s, ©, NULL); ++ attr = © ++ + pa_tagstruct_putu32(t, attr->maxlength); + + if (s->direction == PA_STREAM_PLAYBACK) +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0025-client-include-dolby-channel-names-in-comments.patch b/srcpkgs/pulseaudio/patches/0025-client-include-dolby-channel-names-in-comments.patch new file mode 100644 index 00000000000..8ecba0ac3e1 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0025-client-include-dolby-channel-names-in-comments.patch @@ -0,0 +1,57 @@ +From 86144ee6cb6af54903a8d3d8395751ae26a4d134 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 14 Jan 2010 21:32:26 +0100 +Subject: [PATCH 25/62] client: include dolby channel names in comments + +--- + src/pulse/channelmap.h | 20 ++++++++++---------- + 1 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/src/pulse/channelmap.h b/src/pulse/channelmap.h +index 469effc..d1d5c8b 100644 +--- a/src/pulse/channelmap.h ++++ b/src/pulse/channelmap.h +@@ -74,9 +74,9 @@ typedef enum pa_channel_position { + PA_CHANNEL_POSITION_INVALID = -1, + PA_CHANNEL_POSITION_MONO = 0, + +- PA_CHANNEL_POSITION_FRONT_LEFT, /* Apple calls this 'Left' */ +- PA_CHANNEL_POSITION_FRONT_RIGHT, /* Apple calls this 'Right' */ +- PA_CHANNEL_POSITION_FRONT_CENTER, /* Apple calls this 'Center' */ ++ PA_CHANNEL_POSITION_FRONT_LEFT, /* Apple, Dolby call this 'Left' */ ++ PA_CHANNEL_POSITION_FRONT_RIGHT, /* Apple, Dolby call this 'Right' */ ++ PA_CHANNEL_POSITION_FRONT_CENTER, /* Apple, Dolby call this 'Center' */ + + /** \cond fulldocs */ + PA_CHANNEL_POSITION_LEFT = PA_CHANNEL_POSITION_FRONT_LEFT, +@@ -84,20 +84,20 @@ typedef enum pa_channel_position { + PA_CHANNEL_POSITION_CENTER = PA_CHANNEL_POSITION_FRONT_CENTER, + /** \endcond */ + +- PA_CHANNEL_POSITION_REAR_CENTER, /* Microsoft calls this 'Back Center', Apple calls this 'Center Surround' */ +- PA_CHANNEL_POSITION_REAR_LEFT, /* Microsoft calls this 'Back Left', Apple calls this 'Left Surround' */ +- PA_CHANNEL_POSITION_REAR_RIGHT, /* Microsoft calls this 'Back Right', Apple calls this 'Right Surround' */ ++ PA_CHANNEL_POSITION_REAR_CENTER, /* Microsoft calls this 'Back Center', Apple calls this 'Center Surround', Dolby calls this 'Surround Rear Center' */ ++ PA_CHANNEL_POSITION_REAR_LEFT, /* Microsoft calls this 'Back Left', Apple calls this 'Left Surround' (!), Dolby calls this 'Surround Rear Left' */ ++ PA_CHANNEL_POSITION_REAR_RIGHT, /* Microsoft calls this 'Back Right', Apple calls this 'Right Surround' (!), Dolby calls this 'Surround Rear Right' */ + + PA_CHANNEL_POSITION_LFE, /* Microsoft calls this 'Low Frequency', Apple calls this 'LFEScreen' */ + /** \cond fulldocs */ + PA_CHANNEL_POSITION_SUBWOOFER = PA_CHANNEL_POSITION_LFE, + /** \endcond */ + +- PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, /* Apple calls this 'Left Center' */ +- PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, /* Apple calls this 'Right Center */ ++ PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, /* Apple, Dolby call this 'Left Center' */ ++ PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, /* Apple, Dolby call this 'Right Center */ + +- PA_CHANNEL_POSITION_SIDE_LEFT, /* Apple calls this 'Left Surround Direct' */ +- PA_CHANNEL_POSITION_SIDE_RIGHT, /* Apple calls this 'Right Surround Direct' */ ++ PA_CHANNEL_POSITION_SIDE_LEFT, /* Apple calls this 'Left Surround Direct', Dolby calls this 'Surround Left' (!) */ ++ PA_CHANNEL_POSITION_SIDE_RIGHT, /* Apple calls this 'Right Surround Direct', Dolby calls this 'Surround Right' (!) */ + + PA_CHANNEL_POSITION_AUX0, + PA_CHANNEL_POSITION_AUX1, +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0026-alsa-add-profile-set-for-M-Audio-FastTrack-Pro-USB.patch b/srcpkgs/pulseaudio/patches/0026-alsa-add-profile-set-for-M-Audio-FastTrack-Pro-USB.patch new file mode 100644 index 00000000000..593952b3c75 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0026-alsa-add-profile-set-for-M-Audio-FastTrack-Pro-USB.patch @@ -0,0 +1,116 @@ +From 66e1a2d05139d7968d41d9f1a88c22093cdd04d5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?David=20K=C3=A5gedal?= +Date: Tue, 5 Jan 2010 20:14:11 +0100 +Subject: [PATCH 26/62] alsa: add profile set for M-Audio FastTrack Pro USB + +--- + .../alsa/mixer/profile-sets/90-pulseaudio.rules | 1 + + .../mixer/profile-sets/maudio-fasttrack-pro.conf | 85 ++++++++++++++++++++ + 2 files changed, 86 insertions(+), 0 deletions(-) + create mode 100644 src/modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf + +diff --git a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules +index ea1a2fe..b8e88d0 100644 +--- a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules ++++ b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules +@@ -22,5 +22,6 @@ KERNEL!="card*", GOTO="pulseaudio_end" + + SUBSYSTEMS=="usb", ATTRS{idVendor}=="17cc", ATTRS{idProduct}=="1978", ENV{PULSE_PROFILE_SET}="native-instruments-audio8dj.conf" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="17cc", ATTRS{idProduct}=="0839", ENV{PULSE_PROFILE_SET}="native-instruments-audio4dj.conf" ++SUBSYSTEMS=="usb", ATTRS{idVendor}=="0763", ATTRS{idProduct}=="2012", ENV{PULSE_PROFILE_SET}="maudio-fasttrack-pro.conf" + + LABEL="pulseaudio_end" +diff --git a/src/modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf b/src/modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf +new file mode 100644 +index 0000000..75f5112 +--- /dev/null ++++ b/src/modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf +@@ -0,0 +1,85 @@ ++# This file is part of PulseAudio. ++# ++# PulseAudio is free software; you can redistribute it and/or modify ++# it under the terms of the GNU Lesser General Public License as ++# published by the Free Software Foundation; either version 2.1 of the ++# License, or (at your option) any later version. ++# ++# PulseAudio is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# You should have received a copy of the GNU Lesser General Public License ++# along with PulseAudio; if not, write to the Free Software Foundation, ++# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ++ ++; M-Audio FastTrack Pro ++; ++; This card has one duplex stereo channel called A and an additional ++; stereo output channel called B. ++; ++; We knowingly only define a subset of the theoretically possible ++; mapping combinations as profiles here. ++; ++; See default.conf for an explanation on the directives used here. ++ ++[General] ++auto-profiles = no ++ ++[Mapping analog-stereo-a-output] ++description = Analog Stereo Channel A ++device-strings = hw:%f,0,0 ++channel-map = left,right ++direction = output ++ ++[Mapping analog-stereo-a-input] ++description = Analog Stereo Channel A ++device-strings = hw:%f,0,0 ++channel-map = left,right ++direction = input ++ ++[Mapping analog-stereo-b-output] ++description = Analog Stereo Channel B ++device-strings = hw:%f,1,0 ++channel-map = left,right ++direction = output ++ ++[Profile output:analog-stereo-all+input:analog-stereo-all] ++description = Analog Stereo Duplex Channel A, Analog Stereo output Channel B ++output-mappings = analog-stereo-a-output analog-stereo-b-output ++input-mappings = analog-stereo-a-input ++priority = 100 ++skip-probe = yes ++ ++[Profile output:analog-stereo-a-output+input:analog-stereo-a-input] ++description = Analog Stereo Duplex Channel A ++output-mappings = analog-stereo-a-output ++input-mappings = analog-stereo-a-input ++priority = 40 ++skip-probe = yes ++ ++[Profile output:analog-stereo-b+input:analog-stereo-b] ++description = Analog Stereo Output Channel B ++output-mappings = analog-stereo-b-output ++input-mappings = ++priority = 50 ++skip-probe = yes ++ ++[Profile output:analog-stereo-a] ++description = Analog Stereo Output Channel A ++output-mappings = analog-stereo-a-output ++priority = 5 ++skip-probe = yes ++ ++[Profile output:analog-stereo-b] ++description = Analog Stereo Output Channel B ++output-mappings = analog-stereo-b-output ++priority = 6 ++skip-probe = yes ++ ++[Profile input:analog-stereo-a] ++description = Analog Stereo Input Channel A ++input-mappings = analog-stereo-a-input ++priority = 2 ++skip-probe = yes +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0027-threaded-mainloop-Properly-initialise-m-n_waiting_fo.patch b/srcpkgs/pulseaudio/patches/0027-threaded-mainloop-Properly-initialise-m-n_waiting_fo.patch new file mode 100644 index 00000000000..333599145d1 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0027-threaded-mainloop-Properly-initialise-m-n_waiting_fo.patch @@ -0,0 +1,35 @@ +From a2418effe7c4bc54390939ccd07dd6227e6cdfa5 Mon Sep 17 00:00:00 2001 +From: Daniel T Chen +Date: Mon, 4 Jan 2010 21:44:37 -0500 +Subject: [PATCH 27/62] threaded-mainloop: Properly initialise m->n_waiting_for_accept to prevent deadlock +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Compiler optimisations have been seen to initialise +m->n_waiting_for_accept to a positive non-zero value, so the while() in +pa_threaded_mainloop_signal() never proceeds. Fix this by properly +initializing m->n_waiting_for_accept in pa_threaded_mainloop_new(). + +Patch from Iain BucÅ‚aw. + +https://bugs.launchpad.net/bugs/502992 +--- + src/pulse/thread-mainloop.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c +index 14ed926..1693404 100644 +--- a/src/pulse/thread-mainloop.c ++++ b/src/pulse/thread-mainloop.c +@@ -116,6 +116,7 @@ pa_threaded_mainloop *pa_threaded_mainloop_new(void) { + pa_mainloop_set_poll_func(m->real_mainloop, poll_func, m->mutex); + + m->n_waiting = 0; ++ m->n_waiting_for_accept = 0; + + return m; + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0028-udev-Use-SOUND_CLASS-instead-of-SOUND_FORM_FACTOR-wh.patch b/srcpkgs/pulseaudio/patches/0028-udev-Use-SOUND_CLASS-instead-of-SOUND_FORM_FACTOR-wh.patch new file mode 100644 index 00000000000..eebd0f16859 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0028-udev-Use-SOUND_CLASS-instead-of-SOUND_FORM_FACTOR-wh.patch @@ -0,0 +1,29 @@ +From 8c7148a4eaecd687a004b0611748452fd4b41e92 Mon Sep 17 00:00:00 2001 +From: Daniel T Chen +Date: Mon, 4 Jan 2010 21:53:36 -0500 +Subject: [PATCH 28/62] udev: Use SOUND_CLASS instead of SOUND_FORM_FACTOR when checking for modem + +The fact whether an ALSA card is a modem is stored in the SOUND_CLASS, +not the SOUND_FORM_FACTOR property. So read it from there. + +Patch from Whoopie. +--- + src/modules/module-udev-detect.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c +index b8568b2..3cf3e58 100644 +--- a/src/modules/module-udev-detect.c ++++ b/src/modules/module-udev-detect.c +@@ -426,7 +426,7 @@ static void process_device(struct userdata *u, struct udev_device *dev) { + return; + } + +- if ((ff = udev_device_get_property_value(dev, "SOUND_FORM_FACTOR")) && ++ if ((ff = udev_device_get_property_value(dev, "SOUND_CLASS")) && + pa_streq(ff, "modem")) { + pa_log_debug("Ignoring %s, because it is a modem.", udev_device_get_devpath(dev)); + return; +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0029-More-src-pulsecore-cpu-arm.c-FTBFS-fixes.patch b/srcpkgs/pulseaudio/patches/0029-More-src-pulsecore-cpu-arm.c-FTBFS-fixes.patch new file mode 100644 index 00000000000..d6edbf8ebcf --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0029-More-src-pulsecore-cpu-arm.c-FTBFS-fixes.patch @@ -0,0 +1,39 @@ +From 09c416e11fe4f53c468f68ad0a67f4696241050a Mon Sep 17 00:00:00 2001 +From: Daniel T Chen +Date: Wed, 16 Dec 2009 23:55:05 -0500 +Subject: [PATCH 29/62] More src/pulsecore/cpu-arm.c FTBFS fixes + +Fix missing argument to pa_read(), and be consistent with declaration of +state variable in pa_cpu_init_arm(). + +Signed-off-by: Daniel T Chen +--- + src/pulsecore/cpu-arm.c | 5 +++-- + 1 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/pulsecore/cpu-arm.c b/src/pulsecore/cpu-arm.c +index 453b784..61299cc 100644 +--- a/src/pulsecore/cpu-arm.c ++++ b/src/pulsecore/cpu-arm.c +@@ -67,7 +67,7 @@ static char *get_cpuinfo(void) { + return NULL; + } + +- if ((n = pa_read(fd, cpuinfo, MAX_BUFFER-1)) < 0) { ++ if ((n = pa_read(fd, cpuinfo, MAX_BUFFER-1, NULL)) < 0) { + pa_xfree(cpuinfo); + pa_close(fd); + return NULL; +@@ -105,7 +105,8 @@ void pa_cpu_init_arm (void) { + } + /* get the CPU features */ + if ((line = get_cpuinfo_line (cpuinfo, "Features"))) { +- char *state = NULL, *current; ++ const char *state = NULL; ++ char *current; + + while ((current = pa_split_spaces (line, &state))) { + if (!strcmp (current, "vfp")) +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0030-Fix-the-following-warnings-which-now-cause-buildd-fa.patch b/srcpkgs/pulseaudio/patches/0030-Fix-the-following-warnings-which-now-cause-buildd-fa.patch new file mode 100644 index 00000000000..c9f82bfdc3a --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0030-Fix-the-following-warnings-which-now-cause-buildd-fa.patch @@ -0,0 +1,33 @@ +From fd5c802ecb5ae5ed9b294422410761126a37d1b3 Mon Sep 17 00:00:00 2001 +From: Daniel T Chen +Date: Wed, 16 Dec 2009 22:53:18 -0500 +Subject: [PATCH 30/62] Fix the following warnings (which now cause buildd failures in Ubuntu 10.04): + +pulsecore/cpu-arm.c: In function 'get_cpuinfo': +pulsecore/cpu-arm.c:70: warning: implicit declaration of function 'pa_read' [-Wimplicit-function-declaration] +pulsecore/cpu-arm.c:72: warning: implicit declaration of function 'pa_close' [-Wimplicit-function-declaration] +pulsecore/cpu-arm.c: In function 'pa_cpu_init_arm': +pulsecore/cpu-arm.c:110: warning: implicit declaration of function 'pa_split_spaces' [-Wimplicit-function-declaration] +pulsecore/cpu-arm.c:110: warning: assignment makes pointer from integer without a cast +Function `pa_split_spaces' implicitly converted to pointer at pulsecore/cpu-arm.c:110 + +Signed-off-by: Daniel T Chen +--- + src/pulsecore/cpu-arm.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/src/pulsecore/cpu-arm.c b/src/pulsecore/cpu-arm.c +index 61299cc..56d0bbc 100644 +--- a/src/pulsecore/cpu-arm.c ++++ b/src/pulsecore/cpu-arm.c +@@ -30,6 +30,7 @@ + #include + + #include ++#include + #include + + #include "cpu-arm.h" +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0031-libpulse-Store-pa_stream-pointers-to-hashmaps-instea.patch b/srcpkgs/pulseaudio/patches/0031-libpulse-Store-pa_stream-pointers-to-hashmaps-instea.patch new file mode 100644 index 00000000000..38ebc7c6b0d --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0031-libpulse-Store-pa_stream-pointers-to-hashmaps-instea.patch @@ -0,0 +1,180 @@ +From 52c66b47664d47154b2c8368e32beef27d4b2d03 Mon Sep 17 00:00:00 2001 +From: Tanu Kaskinen +Date: Thu, 3 Dec 2009 13:22:05 +0200 +Subject: [PATCH 31/62] libpulse: Store pa_stream pointers to hashmaps instead of dynarrays. + +Since the stream identifiers (channels) are monotonically growing integer, it +isn't a good idea to use them as index to a dynamic array, because the array +will grow all the time. This is not a problem with client connections that +don't create many streams, but, for example, long-running clients that use +libcanberra for playing event sounds, this means that the client connection +effectively leaks memory. +--- + src/pulse/context.c | 12 ++++++------ + src/pulse/internal.h | 3 +-- + src/pulse/stream.c | 20 ++++++++++---------- + 3 files changed, 17 insertions(+), 18 deletions(-) + +diff --git a/src/pulse/context.c b/src/pulse/context.c +index c83230d..91f4817 100644 +--- a/src/pulse/context.c ++++ b/src/pulse/context.c +@@ -63,7 +63,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -157,8 +157,8 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char * + c->system_bus = c->session_bus = NULL; + #endif + c->mainloop = mainloop; +- c->playback_streams = pa_dynarray_new(); +- c->record_streams = pa_dynarray_new(); ++ c->playback_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); ++ c->record_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); + c->client_index = PA_INVALID_INDEX; + c->use_rtclock = pa_mainloop_is_our_api(mainloop); + +@@ -252,9 +252,9 @@ static void context_free(pa_context *c) { + #endif + + if (c->record_streams) +- pa_dynarray_free(c->record_streams, NULL, NULL); ++ pa_hashmap_free(c->record_streams, NULL, NULL); + if (c->playback_streams) +- pa_dynarray_free(c->playback_streams, NULL, NULL); ++ pa_hashmap_free(c->playback_streams, NULL, NULL); + + if (c->mempool) + pa_mempool_free(c->mempool); +@@ -361,7 +361,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o + + pa_context_ref(c); + +- if ((s = pa_dynarray_get(c->record_streams, channel))) { ++ if ((s = pa_hashmap_get(c->record_streams, PA_UINT32_TO_PTR(channel)))) { + + if (chunk->memblock) { + pa_memblockq_seek(s->record_memblockq, offset, seek, TRUE); +diff --git a/src/pulse/internal.h b/src/pulse/internal.h +index c3ebf74..ab702b9 100644 +--- a/src/pulse/internal.h ++++ b/src/pulse/internal.h +@@ -34,7 +34,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -66,7 +65,7 @@ struct pa_context { + pa_pstream *pstream; + pa_pdispatch *pdispatch; + +- pa_dynarray *record_streams, *playback_streams; ++ pa_hashmap *record_streams, *playback_streams; + PA_LLIST_HEAD(pa_stream, streams); + PA_LLIST_HEAD(pa_operation, operations); + +diff --git a/src/pulse/stream.c b/src/pulse/stream.c +index daeb53a..ab8f8f4 100644 +--- a/src/pulse/stream.c ++++ b/src/pulse/stream.c +@@ -201,7 +201,7 @@ static void stream_unlink(pa_stream *s) { + pa_pdispatch_unregister_reply(s->context->pdispatch, s); + + if (s->channel_valid) { +- pa_dynarray_put((s->direction == PA_STREAM_PLAYBACK) ? s->context->playback_streams : s->context->record_streams, s->channel, NULL); ++ pa_hashmap_remove((s->direction == PA_STREAM_PLAYBACK) ? s->context->playback_streams : s->context->record_streams, PA_UINT32_TO_PTR(s->channel)); + s->channel = 0; + s->channel_valid = FALSE; + } +@@ -356,7 +356,7 @@ void pa_command_stream_killed(pa_pdispatch *pd, uint32_t command, uint32_t tag, + goto finish; + } + +- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_KILLED ? c->playback_streams : c->record_streams, channel))) ++ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_KILLED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel)))) + goto finish; + + if (s->state != PA_STREAM_READY) +@@ -476,7 +476,7 @@ void pa_command_stream_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, p + goto finish; + } + +- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_MOVED ? c->playback_streams : c->record_streams, channel))) ++ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_MOVED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel)))) + goto finish; + + if (s->state != PA_STREAM_READY) +@@ -559,7 +559,7 @@ void pa_command_stream_buffer_attr(pa_pdispatch *pd, uint32_t command, uint32_t + goto finish; + } + +- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_BUFFER_ATTR_CHANGED ? c->playback_streams : c->record_streams, channel))) ++ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_BUFFER_ATTR_CHANGED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel)))) + goto finish; + + if (s->state != PA_STREAM_READY) +@@ -611,7 +611,7 @@ void pa_command_stream_suspended(pa_pdispatch *pd, uint32_t command, uint32_t ta + goto finish; + } + +- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_SUSPENDED ? c->playback_streams : c->record_streams, channel))) ++ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_SUSPENDED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel)))) + goto finish; + + if (s->state != PA_STREAM_READY) +@@ -653,7 +653,7 @@ void pa_command_stream_started(pa_pdispatch *pd, uint32_t command, uint32_t tag, + goto finish; + } + +- if (!(s = pa_dynarray_get(c->playback_streams, channel))) ++ if (!(s = pa_hashmap_get(c->playback_streams, PA_UINT32_TO_PTR(channel)))) + goto finish; + + if (s->state != PA_STREAM_READY) +@@ -699,7 +699,7 @@ void pa_command_stream_event(pa_pdispatch *pd, uint32_t command, uint32_t tag, p + goto finish; + } + +- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_EVENT ? c->playback_streams : c->record_streams, channel))) ++ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_EVENT ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel)))) + goto finish; + + if (s->state != PA_STREAM_READY) +@@ -735,7 +735,7 @@ void pa_command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tag + goto finish; + } + +- if (!(s = pa_dynarray_get(c->playback_streams, channel))) ++ if (!(s = pa_hashmap_get(c->playback_streams, PA_UINT32_TO_PTR(channel)))) + goto finish; + + if (s->state != PA_STREAM_READY) +@@ -771,7 +771,7 @@ void pa_command_overflow_or_underflow(pa_pdispatch *pd, uint32_t command, uint32 + goto finish; + } + +- if (!(s = pa_dynarray_get(c->playback_streams, channel))) ++ if (!(s = pa_hashmap_get(c->playback_streams, PA_UINT32_TO_PTR(channel)))) + goto finish; + + if (s->state != PA_STREAM_READY) +@@ -1019,7 +1019,7 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, + } + + s->channel_valid = TRUE; +- pa_dynarray_put((s->direction == PA_STREAM_RECORD) ? s->context->record_streams : s->context->playback_streams, s->channel, s); ++ pa_hashmap_put((s->direction == PA_STREAM_RECORD) ? s->context->record_streams : s->context->playback_streams, PA_UINT32_TO_PTR(s->channel), s); + + create_stream_complete(s); + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0032-native-rework-handling-of-seeks-that-depend-on-varia.patch b/srcpkgs/pulseaudio/patches/0032-native-rework-handling-of-seeks-that-depend-on-varia.patch new file mode 100644 index 00000000000..1a85b5c11a2 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0032-native-rework-handling-of-seeks-that-depend-on-varia.patch @@ -0,0 +1,166 @@ +From 84782f24c5f43456430c796bd12f9face24f0573 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 18 Jan 2010 01:33:04 +0100 +Subject: [PATCH 32/62] native: rework handling of seeks that depend on variables the client does not know anything about + +All seeks/flushes that depend on the playback buffer read pointer cannot +be accounted for properly in the client since it does not know the +actual read pointer. Due to that the clients do not account for it at +all. We need do the same on the server side. And we did, but a little +bit too extreme. While we properly have not applied the changes to the +"request" counter we still do have to apply it to the "missing" counter. +This patch fixes that. +--- + src/modules/module-combine.c | 4 ++-- + src/modules/module-loopback.c | 4 ++-- + src/pulse/stream.c | 5 +++++ + src/pulsecore/memblockq.c | 6 ++++-- + src/pulsecore/memblockq.h | 2 +- + src/pulsecore/protocol-native.c | 6 +++++- + src/pulsecore/sink-input.c | 2 +- + 7 files changed, 20 insertions(+), 9 deletions(-) + +diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c +index 62e6267..cffb901 100644 +--- a/src/modules/module-combine.c ++++ b/src/modules/module-combine.c +@@ -562,7 +562,7 @@ static int sink_input_process_msg(pa_msgobject *obj, int code, void *data, int64 + if (PA_SINK_IS_OPENED(o->sink_input->sink->thread_info.state)) + pa_memblockq_push_align(o->memblockq, chunk); + else +- pa_memblockq_flush_write(o->memblockq); ++ pa_memblockq_flush_write(o->memblockq, TRUE); + + return 0; + } +@@ -982,7 +982,7 @@ static void output_disable(struct output *o) { + o->sink_input = NULL; + + /* Finally, drop all queued data */ +- pa_memblockq_flush_write(o->memblockq); ++ pa_memblockq_flush_write(o->memblockq, TRUE); + pa_asyncmsgq_flush(o->inq, FALSE); + pa_asyncmsgq_flush(o->outq, FALSE); + } +diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c +index bb0182b..15ef96e 100644 +--- a/src/modules/module-loopback.c ++++ b/src/modules/module-loopback.c +@@ -430,7 +430,7 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in + if (PA_SINK_IS_OPENED(u->sink_input->sink->thread_info.state)) + pa_memblockq_push_align(u->memblockq, chunk); + else +- pa_memblockq_flush_write(u->memblockq); ++ pa_memblockq_flush_write(u->memblockq, TRUE); + + update_min_memblockq_length(u); + +@@ -457,7 +457,7 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in + if (PA_SINK_IS_OPENED(u->sink_input->sink->thread_info.state)) + pa_memblockq_seek(u->memblockq, -offset, PA_SEEK_RELATIVE, TRUE); + else +- pa_memblockq_flush_write(u->memblockq); ++ pa_memblockq_flush_write(u->memblockq, TRUE); + + u->recv_counter -= offset; + +diff --git a/src/pulse/stream.c b/src/pulse/stream.c +index ab8f8f4..8da40ec 100644 +--- a/src/pulse/stream.c ++++ b/src/pulse/stream.c +@@ -2146,6 +2146,11 @@ pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *use + * index, but the read index might jump. */ + invalidate_indexes(s, TRUE, FALSE); + ++ /* Note that we do not update requested_bytes here. This is ++ * because we cannot really know how data actually was dropped ++ * from the write index due to this. This 'error' will be applied ++ * by both client and server and hence we should be fine. */ ++ + return o; + } + +diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c +index 4641801..2b063fa 100644 +--- a/src/pulsecore/memblockq.c ++++ b/src/pulsecore/memblockq.c +@@ -254,6 +254,8 @@ static void write_index_changed(pa_memblockq *bq, int64_t old_write_index, pa_bo + + if (account) + bq->requested -= delta; ++ else ++ bq->missing -= delta; + + /* pa_log("pushed/seeked %lli: requested counter at %lli, account=%i", (long long) delta, (long long) bq->requested, account); */ + } +@@ -642,7 +644,7 @@ void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, pa + write_index_changed(bq, old, account); + } + +-void pa_memblockq_flush_write(pa_memblockq *bq) { ++void pa_memblockq_flush_write(pa_memblockq *bq, pa_bool_t account) { + int64_t old; + pa_assert(bq); + +@@ -652,7 +654,7 @@ void pa_memblockq_flush_write(pa_memblockq *bq) { + bq->write_index = bq->read_index; + + pa_memblockq_prebuf_force(bq); +- write_index_changed(bq, old, TRUE); ++ write_index_changed(bq, old, account); + } + + void pa_memblockq_flush_read(pa_memblockq *bq) { +diff --git a/src/pulsecore/memblockq.h b/src/pulsecore/memblockq.h +index 587c364..6132f31 100644 +--- a/src/pulsecore/memblockq.h ++++ b/src/pulsecore/memblockq.h +@@ -118,7 +118,7 @@ size_t pa_memblockq_pop_missing(pa_memblockq *bq); + int pa_memblockq_splice(pa_memblockq *bq, pa_memblockq *source); + + /* Set the queue to silence, set write index to read index */ +-void pa_memblockq_flush_write(pa_memblockq *bq); ++void pa_memblockq_flush_write(pa_memblockq *bq, pa_bool_t account); + + /* Set the queue to silence, set write read index to write index*/ + void pa_memblockq_flush_read(pa_memblockq *bq); +diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c +index b7b3f59..f80b0c2 100644 +--- a/src/pulsecore/protocol-native.c ++++ b/src/pulsecore/protocol-native.c +@@ -1325,6 +1325,10 @@ static void handle_seek(playback_stream *s, int64_t indexw) { + playback_stream_request_bytes(s); + } + ++static void flush_write_no_account(pa_memblockq *q) { ++ pa_memblockq_flush_write(q, FALSE); ++} ++ + /* Called from thread context */ + static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offset, pa_memchunk *chunk) { + pa_sink_input *i = PA_SINK_INPUT(o); +@@ -1386,7 +1390,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int + + switch (code) { + case SINK_INPUT_MESSAGE_FLUSH: +- func = pa_memblockq_flush_write; ++ func = flush_write_no_account; + break; + + case SINK_INPUT_MESSAGE_PREBUF_FORCE: +diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c +index aa84ccb..7acb25f 100644 +--- a/src/pulsecore/sink-input.c ++++ b/src/pulsecore/sink-input.c +@@ -801,7 +801,7 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam + /* We were asked to drop all buffered data, and rerequest new + * data from implementor the next time push() is called */ + +- pa_memblockq_flush_write(i->thread_info.render_memblockq); ++ pa_memblockq_flush_write(i->thread_info.render_memblockq, TRUE); + + } else if (i->thread_info.rewrite_nbytes > 0) { + size_t max_rewrite, amount; +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0033-core-Fix-macro-typo-PA_SINK_IS_LINKED-PA_SINK_INPUT_.patch b/srcpkgs/pulseaudio/patches/0033-core-Fix-macro-typo-PA_SINK_IS_LINKED-PA_SINK_INPUT_.patch new file mode 100644 index 00000000000..552f7f5b4a6 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0033-core-Fix-macro-typo-PA_SINK_IS_LINKED-PA_SINK_INPUT_.patch @@ -0,0 +1,25 @@ +From a631beeafb4729f8bed1c538846d0bb142cee7bf Mon Sep 17 00:00:00 2001 +From: Colin Guthrie +Date: Tue, 9 Feb 2010 21:37:32 +0000 +Subject: [PATCH 33/62] core: Fix macro typo - PA_SINK_IS_LINKED -> PA_SINK_INPUT_IS_LINKED + +--- + src/pulsecore/sink-input.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c +index 7acb25f..3c957f1 100644 +--- a/src/pulsecore/sink-input.c ++++ b/src/pulsecore/sink-input.c +@@ -1086,7 +1086,7 @@ void pa_sink_input_update_proplist(pa_sink_input *i, pa_update_mode_t mode, pa_p + if (p) + pa_proplist_update(i->proplist, mode, p); + +- if (PA_SINK_IS_LINKED(i->state)) { ++ if (PA_SINK_INPUT_IS_LINKED(i->state)) { + pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_PROPLIST_CHANGED], i); + pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index); + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0034-alsa-cover-Desktop-Speaker-mixer-elements.patch b/srcpkgs/pulseaudio/patches/0034-alsa-cover-Desktop-Speaker-mixer-elements.patch new file mode 100644 index 00000000000..54d6cd9a39b --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0034-alsa-cover-Desktop-Speaker-mixer-elements.patch @@ -0,0 +1,292 @@ +From e8cb96c0103d5bd23fe945afdc658a5f60b70a9d Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 15 Feb 2010 22:23:39 +0100 +Subject: [PATCH 34/62] alsa: cover "Desktop Speaker" mixer elements + +As exposed by really old Microsoft USB sound systems +--- + src/modules/alsa/alsa-mixer.c | 3 +- + .../mixer/paths/analog-output-desktop-speaker.conf | 98 ++++++++++++++++++++ + .../mixer/paths/analog-output-headphones-2.conf | 4 + + .../alsa/mixer/paths/analog-output-headphones.conf | 4 + + .../mixer/paths/analog-output-lfe-on-mono.conf | 4 + + .../alsa/mixer/paths/analog-output-mono.conf | 4 + + .../alsa/mixer/paths/analog-output-speaker.conf | 4 + + src/modules/alsa/mixer/paths/analog-output.conf | 4 + + src/modules/alsa/mixer/profile-sets/default.conf | 14 ++-- + 9 files changed, 131 insertions(+), 8 deletions(-) + create mode 100644 src/modules/alsa/mixer/paths/analog-output-desktop-speaker.conf + +diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c +index 8bbd1f5..cb814af 100644 +--- a/src/modules/alsa/alsa-mixer.c ++++ b/src/modules/alsa/alsa-mixer.c +@@ -1784,7 +1784,8 @@ static int path_verify(pa_alsa_path *p) { + { "analog-output-lfe-on-mono", N_("Analog Output (LFE)") }, + { "analog-output-mono", N_("Analog Mono Output") }, + { "analog-output-headphones-2", N_("Analog Headphones 2") }, +- { "analog-output-speaker", N_("Analog Speaker") } ++ { "analog-output-speaker", N_("Analog Speakers") } ++ { "analog-output-desktop-speaker", N_("Analog Speakers 2") } + }; + + pa_alsa_element *e; +diff --git a/src/modules/alsa/mixer/paths/analog-output-desktop-speaker.conf b/src/modules/alsa/mixer/paths/analog-output-desktop-speaker.conf +new file mode 100644 +index 0000000..9f18b25 +--- /dev/null ++++ b/src/modules/alsa/mixer/paths/analog-output-desktop-speaker.conf +@@ -0,0 +1,98 @@ ++# This file is part of PulseAudio. ++# ++# PulseAudio is free software; you can redistribute it and/or modify ++# it under the terms of the GNU Lesser General Public License as ++# published by the Free Software Foundation; either version 2.1 of the ++# License, or (at your option) any later version. ++# ++# PulseAudio is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# You should have received a copy of the GNU Lesser General Public License ++# along with PulseAudio; if not, write to the Free Software Foundation, ++# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ++ ++; Path for mixers that have a 'Desktop Speaker' control ++; ++; See analog-output.conf.common for an explanation on the directives ++ ++[General] ++priority = 100 ++ ++[Element Hardware Master] ++switch = mute ++volume = merge ++override-map.1 = all ++override-map.2 = all-left,all-right ++ ++[Element Master] ++switch = mute ++volume = merge ++override-map.1 = all ++override-map.2 = all-left,all-right ++ ++[Element Master Mono] ++switch = off ++volume = off ++ ++; This profile path is intended to control the desktop speaker, not ++; the headphones. But it should not hurt if we leave the headphone ++; jack enabled nonetheless. ++[Element Headphone] ++switch = mute ++volume = zero ++ ++[Element Headphone2] ++switch = mute ++volume = zero ++ ++[Element Speaker] ++switch = off ++volume = off ++ ++[Element Desktop Speaker] ++required = any ++switch = mute ++volume = merge ++override-map.1 = all ++override-map.2 = all-left,all-right ++ ++[Element Front] ++switch = mute ++volume = merge ++override-map.1 = all-front ++override-map.2 = front-left,front-right ++ ++[Element Rear] ++switch = mute ++volume = merge ++override-map.1 = all-rear ++override-map.2 = rear-left,rear-right ++ ++[Element Surround] ++switch = mute ++volume = merge ++override-map.1 = all-rear ++override-map.2 = rear-left,rear-right ++ ++[Element Side] ++switch = mute ++volume = merge ++override-map.1 = all-side ++override-map.2 = side-left,side-right ++ ++[Element Center] ++switch = mute ++volume = merge ++override-map.1 = all-center ++override-map.2 = all-center,all-center ++ ++[Element LFE] ++switch = mute ++volume = merge ++override-map.1 = lfe ++override-map.2 = lfe,lfe ++ ++.include analog-output.conf.common +diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf b/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf +index f2fd31c..580c798 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf +@@ -55,6 +55,10 @@ override-map.2 = all-left,all-right + switch = off + volume = off + ++[Element Desktop Speaker] ++switch = off ++volume = off ++ + [Element Front] + switch = off + volume = off +diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones.conf b/src/modules/alsa/mixer/paths/analog-output-headphones.conf +index 2131cfe..79ebc7f 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-headphones.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-headphones.conf +@@ -55,6 +55,10 @@ volume = zero + switch = off + volume = off + ++[Element Desktop Speaker] ++switch = off ++volume = off ++ + [Element Front] + switch = off + volume = off +diff --git a/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf b/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf +index 0a43e27..67ee32f 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf +@@ -58,6 +58,10 @@ volume = merge + override-map.1 = all + override-map.2 = all-left,all-right + ++[Element Desktop Speaker] ++switch = off ++volume = off ++ + [Element Front] + switch = off + volume = off +diff --git a/src/modules/alsa/mixer/paths/analog-output-mono.conf b/src/modules/alsa/mixer/paths/analog-output-mono.conf +index 542edc4..13a2d6a 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-mono.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-mono.conf +@@ -55,6 +55,10 @@ volume = merge + override-map.1 = all + override-map.2 = all-left,all-right + ++[Element Desktop Speaker] ++switch = off ++volume = off ++ + [Element Front] + switch = off + volume = off +diff --git a/src/modules/alsa/mixer/paths/analog-output-speaker.conf b/src/modules/alsa/mixer/paths/analog-output-speaker.conf +index aea7853..b133a2e 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-speaker.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-speaker.conf +@@ -55,6 +55,10 @@ volume = merge + override-map.1 = all + override-map.2 = all-left,all-right + ++[Element Desktop Speaker] ++switch = off ++volume = off ++ + [Element Front] + switch = mute + volume = merge +diff --git a/src/modules/alsa/mixer/paths/analog-output.conf b/src/modules/alsa/mixer/paths/analog-output.conf +index d7c1223..50fc88e 100644 +--- a/src/modules/alsa/mixer/paths/analog-output.conf ++++ b/src/modules/alsa/mixer/paths/analog-output.conf +@@ -53,6 +53,10 @@ volume = zero + switch = mute + volume = off + ++[Element Desktop Speaker] ++switch = mute ++volume = off ++ + [Element Front] + switch = mute + volume = merge +diff --git a/src/modules/alsa/mixer/profile-sets/default.conf b/src/modules/alsa/mixer/profile-sets/default.conf +index 046938f..5d352f1 100644 +--- a/src/modules/alsa/mixer/profile-sets/default.conf ++++ b/src/modules/alsa/mixer/profile-sets/default.conf +@@ -62,42 +62,42 @@ auto-profiles = yes + [Mapping analog-mono] + device-strings = hw:%f + channel-map = mono +-paths-output = analog-output analog-output-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono analog-output-lfe-on-mono ++paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono analog-output-lfe-on-mono + paths-input = analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line + priority = 1 + + [Mapping analog-stereo] + device-strings = front:%f hw:%f + channel-map = left,right +-paths-output = analog-output analog-output-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono analog-output-lfe-on-mono ++paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono analog-output-lfe-on-mono + paths-input = analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line + priority = 10 + + [Mapping analog-surround-40] + device-strings = surround40:%f + channel-map = front-left,front-right,rear-left,rear-right +-paths-output = analog-output analog-output-speaker analog-output-lfe-on-mono ++paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-lfe-on-mono + priority = 7 + direction = output + + [Mapping analog-surround-41] + device-strings = surround41:%f + channel-map = front-left,front-right,rear-left,rear-right,lfe +-paths-output = analog-output analog-output-speaker analog-output-lfe-on-mono ++paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-lfe-on-mono + priority = 8 + direction = output + + [Mapping analog-surround-50] + device-strings = surround50:%f + channel-map = front-left,front-right,rear-left,rear-right,front-center +-paths-output = analog-output analog-output-speaker analog-output-lfe-on-mono ++paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-lfe-on-mono + priority = 7 + direction = output + + [Mapping analog-surround-51] + device-strings = surround51:%f + channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe +-paths-output = analog-output analog-output-speaker analog-output-lfe-on-mono ++paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-lfe-on-mono + priority = 8 + direction = output + +@@ -105,7 +105,7 @@ direction = output + device-strings = surround71:%f + channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right + description = Analog Surround 7.1 +-paths-output = analog-output analog-output-speaker analog-output-lfe-on-mono ++paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-lfe-on-mono + priority = 7 + direction = output + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0035-alsa-cover-Shared-Mic-Line-in-Analog-Source.patch b/srcpkgs/pulseaudio/patches/0035-alsa-cover-Shared-Mic-Line-in-Analog-Source.patch new file mode 100644 index 00000000000..08b57de3e09 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0035-alsa-cover-Shared-Mic-Line-in-Analog-Source.patch @@ -0,0 +1,49 @@ +From 7d6bab0d003386baba3ff3fad4cc3caa5839b361 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 15 Feb 2010 23:39:12 +0100 +Subject: [PATCH 35/62] alsa: cover 'Shared Mic/Line in', 'Analog Source' + +https://bugzilla.redhat.com/show_bug.cgi?id=558638 +--- + .../alsa/mixer/paths/analog-input.conf.common | 25 ++++++++++++++++++++ + 1 files changed, 25 insertions(+), 0 deletions(-) + +diff --git a/src/modules/alsa/mixer/paths/analog-input.conf.common b/src/modules/alsa/mixer/paths/analog-input.conf.common +index fbdc8fb..66c3dda 100644 +--- a/src/modules/alsa/mixer/paths/analog-input.conf.common ++++ b/src/modules/alsa/mixer/paths/analog-input.conf.common +@@ -277,6 +277,31 @@ name = input-microphone + [Option Digital Input Source:Digital Mic 2] + name = input-microphone + ++;;; 'Analog Source' ++ ++[Element Analog Source] ++enumeration = select ++ ++[Option Analog Source:Mic] ++name = input-microphone ++ ++[Option Analog Source:Line in] ++name = input-linein ++ ++[Option Analog Source:Aux] ++name = input ++ ++;;; 'Shared Mic/Line in' ++ ++[Element Shared Mic/Line in] ++enumeration = select ++ ++[Option Shared Mic/Line in:Mic in] ++name = input-microphone ++ ++[Option Shared Mic/Line in:Line in] ++name = input-linein ++ + ;;; Various Boosts + + [Element Capture Boost] +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0036-alsa-cover-Internal-Mic-elements.patch b/srcpkgs/pulseaudio/patches/0036-alsa-cover-Internal-Mic-elements.patch new file mode 100644 index 00000000000..3329bd8e6ec --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0036-alsa-cover-Internal-Mic-elements.patch @@ -0,0 +1,214 @@ +From 0c836aacd8be34bcb5e02581495f7d30a5fbee05 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 16 Feb 2010 00:58:49 +0100 +Subject: [PATCH 36/62] alsa: cover "Internal Mic" elements + +https://bugzilla.redhat.com/show_bug.cgi?id=562216 +--- + src/modules/alsa/mixer/paths/analog-input-aux.conf | 4 + + src/modules/alsa/mixer/paths/analog-input-fm.conf | 4 + + .../mixer/paths/analog-input-internal-mic.conf | 67 ++++++++++++++++++++ + .../alsa/mixer/paths/analog-input-linein.conf | 4 + + .../alsa/mixer/paths/analog-input-mic-line.conf | 4 + + src/modules/alsa/mixer/paths/analog-input-mic.conf | 4 + + .../alsa/mixer/paths/analog-input-tvtuner.conf | 4 + + .../alsa/mixer/paths/analog-input-video.conf | 4 + + src/modules/alsa/mixer/paths/analog-input.conf | 3 + + 9 files changed, 98 insertions(+), 0 deletions(-) + create mode 100644 src/modules/alsa/mixer/paths/analog-input-internal-mic.conf + +diff --git a/src/modules/alsa/mixer/paths/analog-input-aux.conf b/src/modules/alsa/mixer/paths/analog-input-aux.conf +index db78eb4..3a7cb7b 100644 +--- a/src/modules/alsa/mixer/paths/analog-input-aux.conf ++++ b/src/modules/alsa/mixer/paths/analog-input-aux.conf +@@ -32,6 +32,10 @@ override-map.2 = all-left,all-right + switch = off + volume = off + ++[Element Internal Mic] ++switch = off ++volume = off ++ + [Element Line] + switch = off + volume = off +diff --git a/src/modules/alsa/mixer/paths/analog-input-fm.conf b/src/modules/alsa/mixer/paths/analog-input-fm.conf +index baf674a..7f150e3 100644 +--- a/src/modules/alsa/mixer/paths/analog-input-fm.conf ++++ b/src/modules/alsa/mixer/paths/analog-input-fm.conf +@@ -32,6 +32,10 @@ override-map.2 = all-left,all-right + switch = off + volume = off + ++[Element Internal Mic] ++switch = off ++volume = off ++ + [Element Line] + switch = off + volume = off +diff --git a/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf b/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf +new file mode 100644 +index 0000000..70cd512 +--- /dev/null ++++ b/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf +@@ -0,0 +1,67 @@ ++# This file is part of PulseAudio. ++# ++# PulseAudio is free software; you can redistribute it and/or modify ++# it under the terms of the GNU Lesser General Public License as ++# published by the Free Software Foundation; either version 2.1 of the ++# License, or (at your option) any later version. ++# ++# PulseAudio is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# You should have received a copy of the GNU Lesser General Public License ++# along with PulseAudio; if not, write to the Free Software Foundation, ++# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ++ ++; For devices where a 'Internal Mic' element exists ++; ++; See analog-output.conf.common for an explanation on the directives ++ ++[General] ++priority = 90 ++name = analog-input-microphone ++ ++[Element Capture] ++switch = mute ++volume = merge ++override-map.1 = all ++override-map.2 = all-left,all-right ++ ++[Element Mic] ++switch = off ++volume = off ++ ++[Element Internal Mic] ++required = any ++switch = mute ++volume = merge ++override-map.1 = all ++override-map.2 = all-left,all-right ++ ++[Element Line] ++switch = off ++volume = off ++ ++[Element Aux] ++switch = off ++volume = off ++ ++[Element Video] ++switch = off ++volume = off ++ ++[Element Mic/Line] ++switch = off ++volume = off ++ ++[Element TV Tuner] ++switch = off ++volume = off ++ ++[Element FM] ++switch = off ++volume = off ++ ++.include analog-input.conf.common ++.include analog-input-mic.conf.common +diff --git a/src/modules/alsa/mixer/paths/analog-input-linein.conf b/src/modules/alsa/mixer/paths/analog-input-linein.conf +index 4be5722..57568cc 100644 +--- a/src/modules/alsa/mixer/paths/analog-input-linein.conf ++++ b/src/modules/alsa/mixer/paths/analog-input-linein.conf +@@ -31,6 +31,10 @@ override-map.2 = all-left,all-right + switch = off + volume = off + ++[Element Internal Mic] ++switch = off ++volume = off ++ + [Element Line] + required = any + switch = mute +diff --git a/src/modules/alsa/mixer/paths/analog-input-mic-line.conf b/src/modules/alsa/mixer/paths/analog-input-mic-line.conf +index f7f3085..fa680aa 100644 +--- a/src/modules/alsa/mixer/paths/analog-input-mic-line.conf ++++ b/src/modules/alsa/mixer/paths/analog-input-mic-line.conf +@@ -32,6 +32,10 @@ override-map.2 = all-left,all-right + switch = off + volume = off + ++[Element Internal Mic] ++switch = off ++volume = off ++ + [Element Line] + switch = off + volume = off +diff --git a/src/modules/alsa/mixer/paths/analog-input-mic.conf b/src/modules/alsa/mixer/paths/analog-input-mic.conf +index 2a36f2f..9b8b75a 100644 +--- a/src/modules/alsa/mixer/paths/analog-input-mic.conf ++++ b/src/modules/alsa/mixer/paths/analog-input-mic.conf +@@ -35,6 +35,10 @@ volume = merge + override-map.1 = all + override-map.2 = all-left,all-right + ++[Element Internal Mic] ++switch = off ++volume = off ++ + [Element Line] + switch = off + volume = off +diff --git a/src/modules/alsa/mixer/paths/analog-input-tvtuner.conf b/src/modules/alsa/mixer/paths/analog-input-tvtuner.conf +index 8531ec7..fae3ce8 100644 +--- a/src/modules/alsa/mixer/paths/analog-input-tvtuner.conf ++++ b/src/modules/alsa/mixer/paths/analog-input-tvtuner.conf +@@ -32,6 +32,10 @@ override-map.2 = all-left,all-right + switch = off + volume = off + ++[Element Internal Mic] ++switch = off ++volume = off ++ + [Element Line] + switch = off + volume = off +diff --git a/src/modules/alsa/mixer/paths/analog-input-video.conf b/src/modules/alsa/mixer/paths/analog-input-video.conf +index 74c76f0..19f1809 100644 +--- a/src/modules/alsa/mixer/paths/analog-input-video.conf ++++ b/src/modules/alsa/mixer/paths/analog-input-video.conf +@@ -31,6 +31,10 @@ override-map.2 = all-left,all-right + switch = off + volume = off + ++[Element Internal Mic] ++switch = off ++volume = off ++ + [Element Line] + switch = off + volume = off +diff --git a/src/modules/alsa/mixer/paths/analog-input.conf b/src/modules/alsa/mixer/paths/analog-input.conf +index 5055f90..3050738 100644 +--- a/src/modules/alsa/mixer/paths/analog-input.conf ++++ b/src/modules/alsa/mixer/paths/analog-input.conf +@@ -32,6 +32,9 @@ override-map.2 = all-left,all-right + [Element Mic] + required-absent = any + ++[Element Internal Mic] ++required-absent = any ++ + [Element Line] + required-absent = any + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0037-alsa-use-default-output-port-names.patch b/srcpkgs/pulseaudio/patches/0037-alsa-use-default-output-port-names.patch new file mode 100644 index 00000000000..d8b7cd28aab --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0037-alsa-use-default-output-port-names.patch @@ -0,0 +1,82 @@ +From 307bd142feef8f42d3adcea354b72f4c076470e4 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 16 Feb 2010 00:59:24 +0100 +Subject: [PATCH 37/62] alsa: use default output port names + +instead of coming up with pointless aliases, reuse the already established +names, for second headphones, and second speakers. +--- + src/modules/alsa/alsa-mixer.c | 2 -- + .../mixer/paths/analog-output-desktop-speaker.conf | 3 ++- + .../mixer/paths/analog-output-headphones-2.conf | 1 + + .../alsa/mixer/paths/analog-output-headphones.conf | 1 + + .../alsa/mixer/paths/analog-output-speaker.conf | 1 + + 5 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c +index cb814af..93f2ed0 100644 +--- a/src/modules/alsa/alsa-mixer.c ++++ b/src/modules/alsa/alsa-mixer.c +@@ -1783,9 +1783,7 @@ static int path_verify(pa_alsa_path *p) { + { "analog-output-headphones", N_("Analog Headphones") }, + { "analog-output-lfe-on-mono", N_("Analog Output (LFE)") }, + { "analog-output-mono", N_("Analog Mono Output") }, +- { "analog-output-headphones-2", N_("Analog Headphones 2") }, + { "analog-output-speaker", N_("Analog Speakers") } +- { "analog-output-desktop-speaker", N_("Analog Speakers 2") } + }; + + pa_alsa_element *e; +diff --git a/src/modules/alsa/mixer/paths/analog-output-desktop-speaker.conf b/src/modules/alsa/mixer/paths/analog-output-desktop-speaker.conf +index 9f18b25..dfdecf4 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-desktop-speaker.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-desktop-speaker.conf +@@ -19,7 +19,8 @@ + ; See analog-output.conf.common for an explanation on the directives + + [General] +-priority = 100 ++priority = 101 ++name = analog-output-speaker + + [Element Hardware Master] + switch = mute +diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf b/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf +index 580c798..e47543f 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf +@@ -20,6 +20,7 @@ + + [General] + priority = 89 ++name = analog-output-headphones + + [Element Hardware Master] + switch = mute +diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones.conf b/src/modules/alsa/mixer/paths/analog-output-headphones.conf +index 79ebc7f..1d7bb0b 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-headphones.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-headphones.conf +@@ -20,6 +20,7 @@ + + [General] + priority = 90 ++name = analog-output-headphones + + [Element Hardware Master] + switch = mute +diff --git a/src/modules/alsa/mixer/paths/analog-output-speaker.conf b/src/modules/alsa/mixer/paths/analog-output-speaker.conf +index b133a2e..c6916d6 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-speaker.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-speaker.conf +@@ -20,6 +20,7 @@ + + [General] + priority = 100 ++name = analog-output-speaker + + [Element Hardware Master] + switch = mute +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0038-build-sys-add-gobject-to-build-dependencies.patch b/srcpkgs/pulseaudio/patches/0038-build-sys-add-gobject-to-build-dependencies.patch new file mode 100644 index 00000000000..c424d2e393a --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0038-build-sys-add-gobject-to-build-dependencies.patch @@ -0,0 +1,27 @@ +From f9b31fe5443bded4a55b0900f08f04486c3395bd Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 16 Feb 2010 01:43:00 +0100 +Subject: [PATCH 38/62] build-sys: add gobject to build dependencies + +Since we call g_object_unref() we need to link against gobject in +compliance of the new Fedora implicit DSO linking policy. +--- + configure.ac | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/configure.ac b/configure.ac +index c9ec490..1b80788 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -893,7 +893,7 @@ AC_ARG_ENABLE([gconf], + [gconf=auto]) + + if test "x${gconf}" != xno ; then +- PKG_CHECK_MODULES(GCONF, [ gconf-2.0 >= 2.4.0 ], ++ PKG_CHECK_MODULES(GCONF, [ gconf-2.0 >= 2.4.0 gobject-2.0 ], + HAVE_GCONF=1, + [ + HAVE_GCONF=0 +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0039-padsp-emulate-dev-audio-too.patch b/srcpkgs/pulseaudio/patches/0039-padsp-emulate-dev-audio-too.patch new file mode 100644 index 00000000000..4b20ef245ec --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0039-padsp-emulate-dev-audio-too.patch @@ -0,0 +1,142 @@ +From ff2474e5fc9eaa4c7f687e71a39a5bed4f56c259 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 16 Feb 2010 02:03:45 +0100 +Subject: [PATCH 39/62] padsp: emulate /dev/audio, too + +https://bugzilla.redhat.com/show_bug.cgi?id=561262 +--- + src/utils/padsp.c | 55 +++++++++++++++++++--------------------------------- + 1 files changed, 20 insertions(+), 35 deletions(-) + +diff --git a/src/utils/padsp.c b/src/utils/padsp.c +index 2ed0a03..fb756d3 100644 +--- a/src/utils/padsp.c ++++ b/src/utils/padsp.c +@@ -1458,11 +1458,11 @@ static int real_open(const char *filename, int flags, mode_t mode) { + return _open(filename, flags, mode); + } + +- if (filename && dsp_cloak_enable() && (strcmp(filename, "/dev/dsp") == 0 || strcmp(filename, "/dev/adsp") == 0)) ++ if (filename && dsp_cloak_enable() && (pa_streq(filename, "/dev/dsp") || pa_streq(filename, "/dev/adsp") || pa_streq(filename, "/dev/audio"))) + r = dsp_open(flags, &_errno); +- else if (filename && mixer_cloak_enable() && strcmp(filename, "/dev/mixer") == 0) ++ else if (filename && mixer_cloak_enable() && pa_streq(filename, "/dev/mixer")) + r = mixer_open(flags, &_errno); +- else if (filename && sndstat_cloak_enable() && strcmp(filename, "/dev/sndstat") == 0) ++ else if (filename && sndstat_cloak_enable() && pa_streq(filename, "/dev/sndstat")) + r = sndstat_open(flags, &_errno); + else { + function_exit(); +@@ -2383,15 +2383,21 @@ int close(int fd) { + return 0; + } + ++static pa_bool_t is_audio_device_node(const char *path) { ++ return ++ pa_streq(path, "/dev/dsp") || ++ pa_streq(path, "/dev/adsp") || ++ pa_streq(path, "/dev/audio") || ++ pa_streq(path, "/dev/sndstat") || ++ pa_streq(path, "/dev/mixer"); ++} ++ + int access(const char *pathname, int mode) { + + debug(DEBUG_LEVEL_VERBOSE, __FILE__": access(%s)\n", pathname?pathname:"NULL"); + + if (!pathname || +- (strcmp(pathname, "/dev/dsp") != 0 && +- strcmp(pathname, "/dev/adsp") != 0 && +- strcmp(pathname, "/dev/sndstat") != 0 && +- strcmp(pathname, "/dev/mixer") != 0 )) { ++ !is_audio_device_node(pathname)) { + LOAD_ACCESS_FUNC(); + return _access(pathname, mode); + } +@@ -2417,10 +2423,7 @@ int stat(const char *pathname, struct stat *buf) { + + if (!pathname || + !buf || +- ( strcmp(pathname, "/dev/dsp") != 0 && +- strcmp(pathname, "/dev/adsp") != 0 && +- strcmp(pathname, "/dev/sndstat") != 0 && +- strcmp(pathname, "/dev/mixer") != 0 )) { ++ !is_audio_device_node(pathname)) { + debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat(%s)\n", pathname?pathname:"NULL"); + LOAD_STAT_FUNC(); + return _stat(pathname, buf); +@@ -2474,10 +2477,7 @@ int stat64(const char *pathname, struct stat64 *buf) { + + if (!pathname || + !buf || +- ( strcmp(pathname, "/dev/dsp") != 0 && +- strcmp(pathname, "/dev/adsp") != 0 && +- strcmp(pathname, "/dev/sndstat") != 0 && +- strcmp(pathname, "/dev/mixer") != 0 )) { ++ !is_audio_device_node(pathname)) { + LOAD_STAT64_FUNC(); + return _stat64(pathname, buf); + } +@@ -2519,10 +2519,7 @@ int open64(const char *filename, int flags, ...) { + } + + if (!filename || +- ( strcmp(filename, "/dev/dsp") != 0 && +- strcmp(filename, "/dev/adsp") != 0 && +- strcmp(filename, "/dev/sndstat") != 0 && +- strcmp(filename, "/dev/mixer") != 0 )) { ++ !is_audio_device_node(filename)) { + LOAD_OPEN64_FUNC(); + return _open64(filename, flags, mode); + } +@@ -2539,10 +2536,7 @@ int __xstat(int ver, const char *pathname, struct stat *buf) { + + if (!pathname || + !buf || +- ( strcmp(pathname, "/dev/dsp") != 0 && +- strcmp(pathname, "/dev/adsp") != 0 && +- strcmp(pathname, "/dev/sndstat") != 0 && +- strcmp(pathname, "/dev/mixer") != 0 )) { ++ !is_audio_device_node(pathname)) { + LOAD_XSTAT_FUNC(); + return ___xstat(ver, pathname, buf); + } +@@ -2562,10 +2556,7 @@ int __xstat64(int ver, const char *pathname, struct stat64 *buf) { + + if (!pathname || + !buf || +- ( strcmp(pathname, "/dev/dsp") != 0 && +- strcmp(pathname, "/dev/adsp") != 0 && +- strcmp(pathname, "/dev/sndstat") != 0 && +- strcmp(pathname, "/dev/mixer") != 0 )) { ++ !is_audio_device_node(pathname)) { + LOAD_XSTAT64_FUNC(); + return ___xstat64(ver, pathname, buf); + } +@@ -2591,10 +2582,7 @@ FILE* fopen(const char *filename, const char *mode) { + + if (!filename || + !mode || +- ( strcmp(filename, "/dev/dsp") != 0 && +- strcmp(filename, "/dev/adsp") != 0 && +- strcmp(filename, "/dev/sndstat") != 0 && +- strcmp(filename, "/dev/mixer") != 0 )) { ++ !is_audio_device_node(filename)) { + LOAD_FOPEN_FUNC(); + return _fopen(filename, mode); + } +@@ -2634,10 +2622,7 @@ FILE *fopen64(const char *filename, const char *mode) { + + if (!filename || + !mode || +- ( strcmp(filename, "/dev/dsp") != 0 && +- strcmp(filename, "/dev/adsp") != 0 && +- strcmp(filename, "/dev/sndstat") != 0 && +- strcmp(filename, "/dev/mixer") != 0 )) { ++ !is_audio_device_node(filename)) { + LOAD_FOPEN64_FUNC(); + return _fopen64(filename, mode); + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0040-dbus-first-restart-timer-then-dispatch-it.patch b/srcpkgs/pulseaudio/patches/0040-dbus-first-restart-timer-then-dispatch-it.patch new file mode 100644 index 00000000000..93e97734d1d --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0040-dbus-first-restart-timer-then-dispatch-it.patch @@ -0,0 +1,92 @@ +From 96592c21150e789156153dcebd14e201cd41cbeb Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 16 Feb 2010 02:49:44 +0100 +Subject: [PATCH 40/62] dbus: first restart timer, then dispatch it + +This makes sure that we don't access the timer after it might have been +destroyed already from the dbus timeout callback. + +https://bugzilla.redhat.com/attachment.cgi?id=389952 +--- + src/pulsecore/dbus-util.c | 29 ++++++++++++++++------------- + 1 files changed, 16 insertions(+), 13 deletions(-) + +diff --git a/src/pulsecore/dbus-util.c b/src/pulsecore/dbus-util.c +index 4e6148f..40b64a0 100644 +--- a/src/pulsecore/dbus-util.c ++++ b/src/pulsecore/dbus-util.c +@@ -44,17 +44,16 @@ struct pa_dbus_wrap_connection { + }; + + struct timeout_data { +- pa_dbus_wrap_connection *c; ++ pa_dbus_wrap_connection *connection; + DBusTimeout *timeout; + }; + + static void dispatch_cb(pa_mainloop_api *ea, pa_defer_event *ev, void *userdata) { + DBusConnection *conn = userdata; + +- if (dbus_connection_dispatch(conn) == DBUS_DISPATCH_COMPLETE) { ++ if (dbus_connection_dispatch(conn) == DBUS_DISPATCH_COMPLETE) + /* no more data to process, disable the deferred */ + ea->defer_enable(ev, 0); +- } + } + + /* DBusDispatchStatusFunction callback for the pa mainloop */ +@@ -131,13 +130,17 @@ static void handle_time_event(pa_mainloop_api *ea, pa_time_event* e, const struc + struct timeout_data *d = userdata; + + pa_assert(d); +- pa_assert(d->c); ++ pa_assert(d->connection); + + if (dbus_timeout_get_enabled(d->timeout)) { +- dbus_timeout_handle(d->timeout); ++ /* Restart it for the next scheduled time. We do this before ++ * calling dbus_timeout_handle() to make sure that the time ++ * event is still around. */ ++ ea->time_restart(e, pa_timeval_rtstore(&tv, ++ pa_timeval_load(t) + dbus_timeout_get_interval(d->timeout) * PA_USEC_PER_MSEC, ++ d->connection->use_rtclock)); + +- /* restart it for the next scheduled time */ +- ea->time_restart(e, pa_timeval_rtstore(&tv, pa_timeval_load(t) + dbus_timeout_get_interval(d->timeout) * PA_USEC_PER_MSEC, d->c->use_rtclock)); ++ dbus_timeout_handle(d->timeout); + } + } + +@@ -207,7 +210,7 @@ static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data) { + return FALSE; + + d = pa_xnew(struct timeout_data, 1); +- d->c = c; ++ d->connection = c; + d->timeout = timeout; + ev = c->mainloop->time_new(c->mainloop, pa_timeval_rtstore(&tv, pa_rtclock_now() + dbus_timeout_get_interval(timeout) * PA_USEC_PER_MSEC, c->use_rtclock), handle_time_event, d); + c->mainloop->time_set_destroy(ev, time_event_destroy_cb); +@@ -236,15 +239,15 @@ static void toggle_timeout(DBusTimeout *timeout, void *data) { + struct timeval tv; + + pa_assert(d); +- pa_assert(d->c); ++ pa_assert(d->connection); + pa_assert(timeout); + + pa_assert_se(ev = dbus_timeout_get_data(timeout)); + +- if (dbus_timeout_get_enabled(timeout)) { +- d->c->mainloop->time_restart(ev, pa_timeval_rtstore(&tv, pa_rtclock_now() + dbus_timeout_get_interval(timeout) * PA_USEC_PER_MSEC, d->c->use_rtclock)); +- } else +- d->c->mainloop->time_restart(ev, pa_timeval_rtstore(&tv, PA_USEC_INVALID, d->c->use_rtclock)); ++ if (dbus_timeout_get_enabled(timeout)) ++ d->connection->mainloop->time_restart(ev, pa_timeval_rtstore(&tv, pa_rtclock_now() + dbus_timeout_get_interval(timeout) * PA_USEC_PER_MSEC, d->connection->use_rtclock)); ++ else ++ d->connection->mainloop->time_restart(ev, pa_timeval_rtstore(&tv, PA_USEC_INVALID, d->connection->use_rtclock)); + } + + static void wakeup_main(void *userdata) { +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0041-fdsem-be-more-verbose-when-reading-from-eventfd-fail.patch b/srcpkgs/pulseaudio/patches/0041-fdsem-be-more-verbose-when-reading-from-eventfd-fail.patch new file mode 100644 index 00000000000..9267fe1f2b2 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0041-fdsem-be-more-verbose-when-reading-from-eventfd-fail.patch @@ -0,0 +1,111 @@ +From 5e2af2d3f3dea473d46b33a5e90a993ac5da3f35 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 16 Feb 2010 03:36:44 +0100 +Subject: [PATCH 41/62] fdsem: be more verbose when reading from eventfd fails. + +Apperently reading from an eventfd can fail, which results in an assert +to be hit. I am not sure about the reason for the failure, but in +attempt to track down the issue the next time is hit this prints a more +useful log message. + +https://bugzilla.redhat.com/attachment.cgi?id=386380 +--- + src/pulsecore/fdsem.c | 41 +++++++++++++++++++++++++++++++++++------ + 1 files changed, 35 insertions(+), 6 deletions(-) + +diff --git a/src/pulsecore/fdsem.c b/src/pulsecore/fdsem.c +index 380f34f..00836f9 100644 +--- a/src/pulsecore/fdsem.c ++++ b/src/pulsecore/fdsem.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + #include + + #ifndef HAVE_PIPE +@@ -159,7 +160,12 @@ static void flush(pa_fdsem *f) { + uint64_t u; + + if ((r = read(f->efd, &u, sizeof(u))) != sizeof(u)) { +- pa_assert(r < 0 && errno == EINTR); ++ ++ if (r >= 0 || errno != EINTR) { ++ pa_log_error("Invalid read from eventfd: %s", r < 0 ? pa_cstrerror(errno) : "EOF"); ++ pa_assert_not_reached(); ++ } ++ + continue; + } + r = (ssize_t) u; +@@ -167,7 +173,12 @@ static void flush(pa_fdsem *f) { + #endif + + if ((r = read(f->fds[0], &x, sizeof(x))) <= 0) { +- pa_assert(r < 0 && errno == EINTR); ++ ++ if (r >= 0 || errno != EINTR) { ++ pa_log_error("Invalid read from pipe: %s", r < 0 ? pa_cstrerror(errno) : "EOF"); ++ pa_assert_not_reached(); ++ } ++ + continue; + } + +@@ -192,14 +203,22 @@ void pa_fdsem_post(pa_fdsem *f) { + uint64_t u = 1; + + if ((r = write(f->efd, &u, sizeof(u))) != sizeof(u)) { +- pa_assert(r < 0 && errno == EINTR); ++ if (r >= 0 || errno != EINTR) { ++ pa_log_error("Invalid read from pipe: %s", r < 0 ? pa_cstrerror(errno) : "EOF"); ++ pa_assert_not_reached(); ++ } ++ + continue; + } + } else + #endif + + if ((r = write(f->fds[1], &x, 1)) != 1) { +- pa_assert(r < 0 && errno == EINTR); ++ if (r >= 0 || errno != EINTR) { ++ pa_log_error("Invalid read from pipe: %s", r < 0 ? pa_cstrerror(errno) : "EOF"); ++ pa_assert_not_reached(); ++ } ++ + continue; + } + +@@ -228,7 +247,12 @@ void pa_fdsem_wait(pa_fdsem *f) { + uint64_t u; + + if ((r = read(f->efd, &u, sizeof(u))) != sizeof(u)) { +- pa_assert(r < 0 && errno == EINTR); ++ ++ if (r >= 0 || errno != EINTR) { ++ pa_log_error("Invalid read from pipe: %s", r < 0 ? pa_cstrerror(errno) : "EOF"); ++ pa_assert_not_reached(); ++ } ++ + continue; + } + +@@ -237,7 +261,12 @@ void pa_fdsem_wait(pa_fdsem *f) { + #endif + + if ((r = read(f->fds[0], &x, sizeof(x))) <= 0) { +- pa_assert(r < 0 && errno == EINTR); ++ ++ if (r >= 0 || errno != EINTR) { ++ pa_log_error("Invalid read from pipe: %s", r < 0 ? pa_cstrerror(errno) : "EOF"); ++ pa_assert_not_reached(); ++ } ++ + continue; + } + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0042-pacat-always-fully-fulfill-write-requests.patch b/srcpkgs/pulseaudio/patches/0042-pacat-always-fully-fulfill-write-requests.patch new file mode 100644 index 00000000000..c69438f1fe3 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0042-pacat-always-fully-fulfill-write-requests.patch @@ -0,0 +1,79 @@ +From 19fa81bf1375032cb1a27c7715a28a52b238d4cb Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 18 Feb 2010 01:54:51 +0100 +Subject: [PATCH 42/62] pacat: always fully fulfill write requests + +Make sure we always fulfill write requests from the server. If we don't +the server won't ask us again and playback will stay stuck. + +https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-February/006611.html +--- + src/utils/pacat.c | 47 ++++++++++++++++++++++++++++++----------------- + 1 files changed, 30 insertions(+), 17 deletions(-) + +diff --git a/src/utils/pacat.c b/src/utils/pacat.c +index a5d2e9a..d136f6b 100644 +--- a/src/utils/pacat.c ++++ b/src/utils/pacat.c +@@ -195,28 +195,41 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata) { + + pa_assert(sndfile); + +- if (pa_stream_begin_write(s, &data, &length) < 0) { +- pa_log(_("pa_stream_begin_write() failed: %s"), pa_strerror(pa_context_errno(context))); +- quit(1); +- return; +- } ++ for (;;) { ++ size_t data_length = length; + +- if (readf_function) { +- size_t k = pa_frame_size(&sample_spec); ++ if (pa_stream_begin_write(s, &data, &data_length) < 0) { ++ pa_log(_("pa_stream_begin_write() failed: %s"), pa_strerror(pa_context_errno(context))); ++ quit(1); ++ return; ++ } + +- if ((bytes = readf_function(sndfile, data, (sf_count_t) (length/k))) > 0) +- bytes *= (sf_count_t) k; ++ if (readf_function) { ++ size_t k = pa_frame_size(&sample_spec); + +- } else +- bytes = sf_read_raw(sndfile, data, (sf_count_t) length); ++ if ((bytes = readf_function(sndfile, data, (sf_count_t) (data_length/k))) > 0) ++ bytes *= (sf_count_t) k; + +- if (bytes > 0) +- pa_stream_write(s, data, (size_t) bytes, NULL, 0, PA_SEEK_RELATIVE); +- else +- pa_stream_cancel_write(s); ++ } else ++ bytes = sf_read_raw(sndfile, data, (sf_count_t) data_length); + +- if (bytes < (sf_count_t) length) +- start_drain(); ++ if (bytes > 0) ++ pa_stream_write(s, data, (size_t) bytes, NULL, 0, PA_SEEK_RELATIVE); ++ else ++ pa_stream_cancel_write(s); ++ ++ /* EOF? */ ++ if (bytes < (sf_count_t) data_length) { ++ start_drain(); ++ break; ++ } ++ ++ /* Request fulfilled */ ++ if ((size_t) bytes >= length) ++ break; ++ ++ length -= bytes; ++ } + } + } + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0043-pacmd-store-away-fd-type.patch b/srcpkgs/pulseaudio/patches/0043-pacmd-store-away-fd-type.patch new file mode 100644 index 00000000000..d71cb81aa89 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0043-pacmd-store-away-fd-type.patch @@ -0,0 +1,60 @@ +From 96ec29c6b2a40d3851f46587143a4ba6dce29d0d Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 18 Feb 2010 02:32:35 +0100 +Subject: [PATCH 43/62] pacmd: store away fd type + +--- + src/utils/pacmd.c | 9 +++++---- + 1 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c +index 5ef57e3..59aae48 100644 +--- a/src/utils/pacmd.c ++++ b/src/utils/pacmd.c +@@ -61,6 +61,7 @@ int main(int argc, char*argv[]) { + char *cli; + pa_bool_t ibuf_eof, obuf_eof, ibuf_closed, obuf_closed; + struct pollfd pollfd[N_WATCH]; ++ int stdin_type = 0, stdout_type = 0, fd_type = 0; + + setlocale(LC_ALL, ""); + bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR); +@@ -166,7 +167,7 @@ int main(int argc, char*argv[]) { + ssize_t r; + pa_assert(!ibuf_length); + +- if ((r = pa_read(STDIN_FILENO, ibuf, sizeof(ibuf), NULL)) <= 0) { ++ if ((r = pa_read(STDIN_FILENO, ibuf, sizeof(ibuf), &stdin_type)) <= 0) { + if (r < 0) { + pa_log(_("read(): %s"), strerror(errno)); + goto fail; +@@ -183,7 +184,7 @@ int main(int argc, char*argv[]) { + ssize_t r; + pa_assert(!obuf_length); + +- if ((r = pa_read(fd, obuf, sizeof(obuf), NULL)) <= 0) { ++ if ((r = pa_read(fd, obuf, sizeof(obuf), &fd_type)) <= 0) { + if (r < 0) { + pa_log(_("read(): %s"), strerror(errno)); + goto fail; +@@ -203,7 +204,7 @@ int main(int argc, char*argv[]) { + ssize_t r; + pa_assert(obuf_length); + +- if ((r = pa_write(STDOUT_FILENO, obuf + obuf_index, obuf_length, NULL)) < 0) { ++ if ((r = pa_write(STDOUT_FILENO, obuf + obuf_index, obuf_length, &stdout_type)) < 0) { + pa_log(_("write(): %s"), strerror(errno)); + goto fail; + } +@@ -219,7 +220,7 @@ int main(int argc, char*argv[]) { + ssize_t r; + pa_assert(ibuf_length); + +- if ((r = pa_write(fd, ibuf + ibuf_index, ibuf_length, NULL)) < 0) { ++ if ((r = pa_write(fd, ibuf + ibuf_index, ibuf_length, &fd_type)) < 0) { + pa_log(_("write(): %s"), strerror(errno)); + goto fail; + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0044-pacmd-don-t-enter-busy-loop-when-reading-from-stdin-.patch b/srcpkgs/pulseaudio/patches/0044-pacmd-don-t-enter-busy-loop-when-reading-from-stdin-.patch new file mode 100644 index 00000000000..5066980811f --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0044-pacmd-don-t-enter-busy-loop-when-reading-from-stdin-.patch @@ -0,0 +1,257 @@ +From 6e064d1d6d0292d230c752b1f41034fd0754487b Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 18 Feb 2010 03:28:56 +0100 +Subject: [PATCH 44/62] pacmd: don't enter busy loop when reading from stdin very early + +pointed out in: + +https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-January/006365.html +--- + src/utils/pacmd.c | 186 ++++++++++++++++++++++++++++------------------------ + 1 files changed, 100 insertions(+), 86 deletions(-) + +diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c +index 59aae48..87661e3 100644 +--- a/src/utils/pacmd.c ++++ b/src/utils/pacmd.c +@@ -45,13 +45,6 @@ + + int main(int argc, char*argv[]) { + +- enum { +- WATCH_STDIN, +- WATCH_STDOUT, +- WATCH_SOCKET, +- N_WATCH +- }; +- + pid_t pid ; + int fd = -1; + int ret = 1, i; +@@ -60,7 +53,9 @@ int main(int argc, char*argv[]) { + size_t ibuf_index, ibuf_length, obuf_index, obuf_length; + char *cli; + pa_bool_t ibuf_eof, obuf_eof, ibuf_closed, obuf_closed; +- struct pollfd pollfd[N_WATCH]; ++ struct pollfd pollfd[3]; ++ struct pollfd *watch_socket, *watch_stdin, *watch_stdout; ++ + int stdin_type = 0, stdout_type = 0, fd_type = 0; + + setlocale(LC_ALL, ""); +@@ -129,32 +124,53 @@ int main(int argc, char*argv[]) { + ibuf_eof = TRUE; + } + +- pa_zero(pollfd); +- +- pollfd[WATCH_STDIN].fd = STDIN_FILENO; +- pollfd[WATCH_STDOUT].fd = STDOUT_FILENO; +- pollfd[WATCH_SOCKET].fd = fd; +- + for (;;) { ++ struct pollfd *p; ++ + if (ibuf_eof && + obuf_eof && + ibuf_length <= 0 && + obuf_length <= 0) + break; + +- pollfd[WATCH_STDIN].events = pollfd[WATCH_STDOUT].events = pollfd[WATCH_SOCKET].events = 0; ++ if (ibuf_length <= 0 && ibuf_eof && !ibuf_closed) { ++ shutdown(fd, SHUT_WR); ++ ibuf_closed = TRUE; ++ } + +- if (obuf_length > 0) +- pollfd[WATCH_STDOUT].events |= POLLOUT; +- else if (!obuf_eof) +- pollfd[WATCH_SOCKET].events |= POLLIN; ++ if (obuf_length <= 0 && obuf_eof && !obuf_closed) { ++ shutdown(fd, SHUT_RD); ++ obuf_closed = TRUE; ++ } ++ ++ pa_zero(pollfd); ++ ++ p = pollfd; + +- if (ibuf_length > 0) +- pollfd[WATCH_SOCKET].events |= POLLOUT; +- else if (!ibuf_eof) +- pollfd[WATCH_STDIN].events |= POLLIN; ++ if (ibuf_length > 0 || (!obuf_eof && obuf_length <= 0)) { ++ watch_socket = p++; ++ watch_socket->fd = fd; ++ watch_socket->events = ++ (ibuf_length > 0 ? POLLOUT : 0) | ++ (!obuf_eof && obuf_length <= 0 ? POLLIN : 0); ++ } else ++ watch_socket = NULL; + +- if (poll(pollfd, N_WATCH, -1) < 0) { ++ if (!ibuf_eof && ibuf_length <= 0) { ++ watch_stdin = p++; ++ watch_stdin->fd = STDIN_FILENO; ++ watch_stdin->events = POLLIN; ++ } else ++ watch_stdin = NULL; ++ ++ if (obuf_length > 0) { ++ watch_stdout = p++; ++ watch_stdout->fd = STDOUT_FILENO; ++ watch_stdout->events = POLLOUT; ++ } else ++ watch_stdout = NULL; ++ ++ if (poll(pollfd, p-pollfd, -1) < 0) { + + if (errno == EINTR) + continue; +@@ -163,82 +179,80 @@ int main(int argc, char*argv[]) { + goto fail; + } + +- if (pollfd[WATCH_STDIN].revents & POLLIN) { +- ssize_t r; +- pa_assert(!ibuf_length); +- +- if ((r = pa_read(STDIN_FILENO, ibuf, sizeof(ibuf), &stdin_type)) <= 0) { +- if (r < 0) { +- pa_log(_("read(): %s"), strerror(errno)); +- goto fail; ++ if (watch_stdin) { ++ if (watch_stdin->revents & POLLIN) { ++ ssize_t r; ++ pa_assert(ibuf_length <= 0); ++ ++ if ((r = pa_read(STDIN_FILENO, ibuf, sizeof(ibuf), &stdin_type)) <= 0) { ++ if (r < 0) { ++ pa_log(_("read(): %s"), strerror(errno)); ++ goto fail; ++ } ++ ++ ibuf_eof = TRUE; ++ } else { ++ ibuf_length = (size_t) r; ++ ibuf_index = 0; + } +- ++ } else if (watch_stdin->revents & POLLHUP) + ibuf_eof = TRUE; +- } else { +- ibuf_length = (size_t) r; +- ibuf_index = 0; +- } + } + +- if (pollfd[WATCH_SOCKET].revents & POLLIN) { +- ssize_t r; +- pa_assert(!obuf_length); +- +- if ((r = pa_read(fd, obuf, sizeof(obuf), &fd_type)) <= 0) { +- if (r < 0) { +- pa_log(_("read(): %s"), strerror(errno)); +- goto fail; ++ if (watch_socket) { ++ if (watch_socket->revents & POLLIN) { ++ ssize_t r; ++ pa_assert(obuf_length <= 0); ++ ++ if ((r = pa_read(fd, obuf, sizeof(obuf), &fd_type)) <= 0) { ++ if (r < 0) { ++ pa_log(_("read(): %s"), strerror(errno)); ++ goto fail; ++ } ++ ++ obuf_eof = TRUE; ++ } else { ++ obuf_length = (size_t) r; ++ obuf_index = 0; + } +- ++ } else if (watch_socket->revents & POLLHUP) + obuf_eof = TRUE; +- } else { +- obuf_length = (size_t) r; +- obuf_index = 0; +- } + } + +- if (pollfd[WATCH_STDOUT].revents & POLLHUP) { +- obuf_eof = TRUE; +- obuf_length = 0; +- } else if (pollfd[WATCH_STDOUT].revents & POLLOUT) { +- ssize_t r; +- pa_assert(obuf_length); +- +- if ((r = pa_write(STDOUT_FILENO, obuf + obuf_index, obuf_length, &stdout_type)) < 0) { +- pa_log(_("write(): %s"), strerror(errno)); +- goto fail; +- } +- +- obuf_length -= (size_t) r; +- obuf_index += obuf_index; +- } ++ if (watch_stdout) { ++ if (watch_stdout->revents & POLLHUP) { ++ obuf_eof = TRUE; ++ obuf_length = 0; ++ } else if (watch_stdout->revents & POLLOUT) { ++ ssize_t r; ++ pa_assert(obuf_length > 0); + +- if (pollfd[WATCH_SOCKET].revents & POLLHUP) { +- ibuf_eof = TRUE; +- ibuf_length = 0; +- } if (pollfd[WATCH_SOCKET].revents & POLLOUT) { +- ssize_t r; +- pa_assert(ibuf_length); ++ if ((r = pa_write(STDOUT_FILENO, obuf + obuf_index, obuf_length, &stdout_type)) < 0) { ++ pa_log(_("write(): %s"), strerror(errno)); ++ goto fail; ++ } + +- if ((r = pa_write(fd, ibuf + ibuf_index, ibuf_length, &fd_type)) < 0) { +- pa_log(_("write(): %s"), strerror(errno)); +- goto fail; ++ obuf_length -= (size_t) r; ++ obuf_index += obuf_index; + } +- +- ibuf_length -= (size_t) r; +- ibuf_index += obuf_index; + } + +- if (ibuf_length <= 0 && ibuf_eof && !ibuf_closed) { +- pa_close(STDIN_FILENO); +- shutdown(fd, SHUT_WR); +- ibuf_closed = TRUE; +- } ++ if (watch_socket) { ++ if (watch_socket->revents & POLLHUP) { ++ ibuf_eof = TRUE; ++ ibuf_length = 0; ++ } if (watch_socket->revents & POLLOUT) { ++ ssize_t r; ++ pa_assert(ibuf_length > 0); + +- if (obuf_length <= 0 && obuf_eof && !obuf_closed) { +- shutdown(fd, SHUT_RD); +- pa_close(STDOUT_FILENO); +- obuf_closed = TRUE; ++ if ((r = pa_write(fd, ibuf + ibuf_index, ibuf_length, &fd_type)) < 0) { ++ pa_log(_("write(): %s"), strerror(errno)); ++ goto fail; ++ } ++ ++ ibuf_length -= (size_t) r; ++ ibuf_index += obuf_index; ++ } + } + } + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0045-shm-don-t-complain-about-missing-SHM-segments.patch b/srcpkgs/pulseaudio/patches/0045-shm-don-t-complain-about-missing-SHM-segments.patch new file mode 100644 index 00000000000..8f2af7aeeb3 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0045-shm-don-t-complain-about-missing-SHM-segments.patch @@ -0,0 +1,29 @@ +From dfe27f623765b20bdaff2306109f89baca67d0cf Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 19 Feb 2010 03:29:36 +0100 +Subject: [PATCH 45/62] shm: don't complain about missing SHM segments + +If two clients try to cleanup the SHM directory at the same time, they +might want to open and then delete the same segment at the same time, in +which case one client might win, the other one lose. In this case, don't +warn about ENOENT. +--- + src/pulsecore/shm.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c +index fbf777a..1e31d54 100644 +--- a/src/pulsecore/shm.c ++++ b/src/pulsecore/shm.c +@@ -286,7 +286,7 @@ int pa_shm_attach_ro(pa_shm *m, unsigned id) { + segment_name(fn, sizeof(fn), m->id = id); + + if ((fd = shm_open(fn, O_RDONLY, 0)) < 0) { +- if (errno != EACCES) ++ if (errno != EACCES && errno != ENOENT) + pa_log("shm_open() failed: %s", pa_cstrerror(errno)); + goto fail; + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0046-vala-fix-definition-of-INVALID_INDEX.patch b/srcpkgs/pulseaudio/patches/0046-vala-fix-definition-of-INVALID_INDEX.patch new file mode 100644 index 00000000000..dbad446fbd4 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0046-vala-fix-definition-of-INVALID_INDEX.patch @@ -0,0 +1,25 @@ +From 5ce18c32f6ba8202c9f17f84aaffbdbbd8df071c Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 19 Feb 2010 03:31:46 +0100 +Subject: [PATCH 46/62] vala: fix definition of INVALID_INDEX + +--- + vala/libpulse.vapi | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/vala/libpulse.vapi b/vala/libpulse.vapi +index 9e05b14..b02bb56 100644 +--- a/vala/libpulse.vapi ++++ b/vala/libpulse.vapi +@@ -46,7 +46,7 @@ namespace PulseAudio { + [CCode (cname="PA_CHECK_VERSION")] + public bool CHECK_VERSION(int major, int minor, int micro); + +- [CCode (cname="INVALID_INDEX")] ++ [CCode (cname="PA_INVALID_INDEX")] + public const uint32 INVALID_INDEX; + + [CCode (cname="pa_free_cb_t")] +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0047-vala-fix-definition-of-the-GLib-mainloop-adapter.patch b/srcpkgs/pulseaudio/patches/0047-vala-fix-definition-of-the-GLib-mainloop-adapter.patch new file mode 100644 index 00000000000..6946e6bd783 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0047-vala-fix-definition-of-the-GLib-mainloop-adapter.patch @@ -0,0 +1,30 @@ +From 6bbdd200e89bdbf180071e5281c0feb9617de81d Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 19 Feb 2010 03:32:00 +0100 +Subject: [PATCH 47/62] vala: fix definition of the GLib mainloop adapter + +--- + vala/libpulse.vapi | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/vala/libpulse.vapi b/vala/libpulse.vapi +index b02bb56..d47ef73 100644 +--- a/vala/libpulse.vapi ++++ b/vala/libpulse.vapi +@@ -879,11 +879,11 @@ namespace PulseAudio { + } + + [Compact] +- [CCode (cname="pa_glib_mainloop", cprefix="pa_glib_mainloop_", free_function="pa_glib_mainloop_free")] ++ [CCode (cheader_filename="pulse/glib-mainloop.h", cname="pa_glib_mainloop", cprefix="pa_glib_mainloop_", free_function="pa_glib_mainloop_free")] + public class GLibMainLoop { + + [CCode (cname="pa_glib_mainloop_new")] +- public GLibMainLoop(); ++ public GLibMainLoop(MainContext? c = null); + + public unowned MainLoopApi get_api(); + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0048-Add-missing-profile-and-alsa-mixer-paths-to-src-Make.patch b/srcpkgs/pulseaudio/patches/0048-Add-missing-profile-and-alsa-mixer-paths-to-src-Make.patch new file mode 100644 index 00000000000..79eb009e62b --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0048-Add-missing-profile-and-alsa-mixer-paths-to-src-Make.patch @@ -0,0 +1,49 @@ +From 047e16f2d18c20ea8d9dbb8a24175e1c4bb34d5e Mon Sep 17 00:00:00 2001 +From: Daniel T Chen +Date: Fri, 19 Feb 2010 00:23:17 -0500 +Subject: [PATCH 48/62] Add missing profile and alsa-mixer/paths to src/Makefile.am + +Commits e8cb96c and 0c836aa created mixer paths but did not update +src/Makefile.am. Building a snapshot containing these two commits +therefore results in the user being unable to adjust the volume or +(un)mute through PA. Fix this by adding the two new mixer paths +files to src/Makefile.am. + +Likewise, commit 66e1a2d created a profile for the M-Audio FastTrack +Pro USB but did not update src/Makefile.am. Fix this by adding the +profile to src/Makefile.am. +--- + src/Makefile.am | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/src/Makefile.am b/src/Makefile.am +index 598e77f..ffe7558 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -109,6 +109,7 @@ MODULE_LDFLAGS = -module -disable-static -avoid-version $(LDFLAGS_NOUNDEFINED) + + ALSA_PROFILES = \ + modules/alsa/mixer/profile-sets/default.conf \ ++ modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf \ + modules/alsa/mixer/profile-sets/native-instruments-audio4dj.conf \ + modules/alsa/mixer/profile-sets/native-instruments-audio8dj.conf + +@@ -117,6 +118,7 @@ ALSA_PATHS = \ + modules/alsa/mixer/paths/analog-input.conf \ + modules/alsa/mixer/paths/analog-input.conf.common \ + modules/alsa/mixer/paths/analog-input-fm.conf \ ++ modules/alsa/mixer/paths/analog-input-internal-mic.conf \ + modules/alsa/mixer/paths/analog-input-linein.conf \ + modules/alsa/mixer/paths/analog-input-mic.conf \ + modules/alsa/mixer/paths/analog-input-mic.conf.common \ +@@ -126,6 +128,7 @@ ALSA_PATHS = \ + modules/alsa/mixer/paths/analog-output.conf \ + modules/alsa/mixer/paths/analog-output-speaker.conf \ + modules/alsa/mixer/paths/analog-output.conf.common \ ++ modules/alsa/mixer/paths/analog-output-desktop-speaker.conf \ + modules/alsa/mixer/paths/analog-output-headphones.conf \ + modules/alsa/mixer/paths/analog-output-headphones-2.conf \ + modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf \ +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0049-channelmap-Use-Subwoofer-as-pretty-name-for-LFE.patch b/srcpkgs/pulseaudio/patches/0049-channelmap-Use-Subwoofer-as-pretty-name-for-LFE.patch new file mode 100644 index 00000000000..2223ee09627 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0049-channelmap-Use-Subwoofer-as-pretty-name-for-LFE.patch @@ -0,0 +1,28 @@ +From 3f44bf0afaba9c227f09a475f4886c14813afc2f Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Sun, 21 Feb 2010 16:19:40 +0100 +Subject: [PATCH 49/62] channelmap: Use "Subwoofer" as pretty name for LFE + +The pretty name is suspposed to be understandable by non-technical +folks, and they are generally more used to the term "Subwoofer" than +"Low Frequency Emitter", so let's change the name here. +--- + src/pulse/channelmap.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c +index 9b51626..83fdb43 100644 +--- a/src/pulse/channelmap.c ++++ b/src/pulse/channelmap.c +@@ -112,7 +112,7 @@ const char *const pretty_table[PA_CHANNEL_POSITION_MAX] = { + [PA_CHANNEL_POSITION_REAR_LEFT] = N_("Rear Left"), + [PA_CHANNEL_POSITION_REAR_RIGHT] = N_("Rear Right"), + +- [PA_CHANNEL_POSITION_LFE] = N_("Low Frequency Emmiter"), ++ [PA_CHANNEL_POSITION_LFE] = N_("Subwoofer"), + + [PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER] = N_("Front Left-of-center"), + [PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER] = N_("Front Right-of-center"), +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0050-vala-fix-wrapping-of-port-setting-calls.patch b/srcpkgs/pulseaudio/patches/0050-vala-fix-wrapping-of-port-setting-calls.patch new file mode 100644 index 00000000000..9bc20b8f115 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0050-vala-fix-wrapping-of-port-setting-calls.patch @@ -0,0 +1,34 @@ +From 117c99de3af9a19104d946852821f7b2f5646526 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Sun, 21 Feb 2010 16:21:13 +0100 +Subject: [PATCH 50/62] vala: fix wrapping of port setting calls + +--- + vala/libpulse.vapi | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/vala/libpulse.vapi b/vala/libpulse.vapi +index d47ef73..21c0f7c 100644 +--- a/vala/libpulse.vapi ++++ b/vala/libpulse.vapi +@@ -1024,7 +1024,7 @@ namespace PulseAudio { + public Operation? suspend_sink_by_index(uint32 idx, bool suspend, SuccessCb? cb = null); + + public Operation? set_sink_port_by_name(string name, string port, SuccessCb? cb = null); +- public Operation? set_sink_port_by_index(string idx, string port, SuccessCb? cb = null); ++ public Operation? set_sink_port_by_index(uint32 idx, string port, SuccessCb? cb = null); + + public Operation? get_source_info_by_name(string name, SourceInfoCb cb); + public Operation? get_source_info_by_index(uint32 idx, SourceInfoCb cb); +@@ -1039,7 +1039,7 @@ namespace PulseAudio { + public Operation? suspend_source_by_index(uint32 idx, bool suspend, SuccessCb? cb = null); + + public Operation? set_source_port_by_name(string name, string port, SuccessCb? cb = null); +- public Operation? set_source_port_by_index(string idx, string port, SuccessCb? cb = null); ++ public Operation? set_source_port_by_index(uint32 idx, string port, SuccessCb? cb = null); + + public Operation? get_server_info(ServerInfoCb cb); + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0051-proplist-explicitly-mention-a-role-test.patch b/srcpkgs/pulseaudio/patches/0051-proplist-explicitly-mention-a-role-test.patch new file mode 100644 index 00000000000..739f20231a4 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0051-proplist-explicitly-mention-a-role-test.patch @@ -0,0 +1,25 @@ +From ddabaa3b0f7b95e2cf5279f5be74769905af8496 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Sun, 21 Feb 2010 16:21:43 +0100 +Subject: [PATCH 51/62] proplist: explicitly mention a role 'test' + +--- + src/pulse/proplist.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/pulse/proplist.h b/src/pulse/proplist.h +index 8dff8df..6283177 100644 +--- a/src/pulse/proplist.h ++++ b/src/pulse/proplist.h +@@ -59,7 +59,7 @@ PA_C_DECL_BEGIN + /** For streams: an XDG icon name for the media. e.g. "audio-x-mp3" */ + #define PA_PROP_MEDIA_ICON_NAME "media.icon_name" + +-/** For streams: logic role of this media. One of the strings "video", "music", "game", "event", "phone", "animation", "production", "a11y" */ ++/** For streams: logic role of this media. One of the strings "video", "music", "game", "event", "phone", "animation", "production", "a11y", "test" */ + #define PA_PROP_MEDIA_ROLE "media.role" + + /** For event sound streams: XDG event sound name. e.g. "message-new-email" (Event sound streams are those with media.role set to "event") */ +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0052-stream-restore-be-a-little-bit-more-verbose-why-we-d.patch b/srcpkgs/pulseaudio/patches/0052-stream-restore-be-a-little-bit-more-verbose-why-we-d.patch new file mode 100644 index 00000000000..23d1cd8891a --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0052-stream-restore-be-a-little-bit-more-verbose-why-we-d.patch @@ -0,0 +1,25 @@ +From 8adf536426a86e986fb5bd4ad31ba2d50054c485 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Sun, 21 Feb 2010 16:22:17 +0100 +Subject: [PATCH 52/62] stream-restore: be a little bit more verbose why we don't reastore a sink + +--- + src/modules/module-stream-restore.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c +index 9b6f914..00ce5ab 100644 +--- a/src/modules/module-stream-restore.c ++++ b/src/modules/module-stream-restore.c +@@ -394,7 +394,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n + return PA_HOOK_OK; + + if (new_data->sink) +- pa_log_debug("Not restoring device for stream %s, because already set.", name); ++ pa_log_debug("Not restoring device for stream %s, because already set to '%s'.", name, new_data->sink->name); + else if ((e = read_entry(u, name))) { + pa_sink *s = NULL; + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0053-sample-cache-use-the-sample-name-as-unmodified-fallb.patch b/srcpkgs/pulseaudio/patches/0053-sample-cache-use-the-sample-name-as-unmodified-fallb.patch new file mode 100644 index 00000000000..04613752235 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0053-sample-cache-use-the-sample-name-as-unmodified-fallb.patch @@ -0,0 +1,26 @@ +From 180589511dab1b5d0388b58b41a0e9843ea1a35a Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Sun, 21 Feb 2010 16:23:25 +0100 +Subject: [PATCH 53/62] sample-cache: use the sample name as unmodified fallback in the properties when playing a sample from the cache + +--- + src/pulsecore/core-scache.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/src/pulsecore/core-scache.c b/src/pulsecore/core-scache.c +index 1fb81d0..95aaa10 100644 +--- a/src/pulsecore/core-scache.c ++++ b/src/pulsecore/core-scache.c +@@ -310,7 +310,8 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t + return -1; + + merged = pa_proplist_new(); +- pa_proplist_setf(merged, PA_PROP_MEDIA_NAME, "Sample %s", name); ++ pa_proplist_sets(merged, PA_PROP_MEDIA_NAME, name); ++ pa_proplist_sets(merged, PA_PROP_EVENT_ID, name); + + if (e->lazy && !e->memchunk.memblock) { + pa_channel_map old_channel_map = e->channel_map; +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0054-scache-when-playing-a-sample-from-the-cache-make-sur.patch b/srcpkgs/pulseaudio/patches/0054-scache-when-playing-a-sample-from-the-cache-make-sur.patch new file mode 100644 index 00000000000..93bc081722e --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0054-scache-when-playing-a-sample-from-the-cache-make-sur.patch @@ -0,0 +1,153 @@ +From f9b9579cf4fe65d3619629b5bc28ce02ceca305e Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Sun, 21 Feb 2010 17:35:05 +0100 +Subject: [PATCH 54/62] scache: when playing a sample from the cache make sure not queue them up when the sink is suspended + +libcanberra already sets the appropriate flags for uncached sample +streams, we now need to make sure to set them for cached samples too. +--- + src/pulsecore/core-scache.c | 7 ++++++- + src/pulsecore/play-memblockq.c | 7 +++++-- + src/pulsecore/play-memblockq.h | 18 ++++++++++-------- + src/pulsecore/play-memchunk.c | 3 ++- + src/pulsecore/play-memchunk.h | 15 ++++++++------- + 5 files changed, 31 insertions(+), 19 deletions(-) + +diff --git a/src/pulsecore/core-scache.c b/src/pulsecore/core-scache.c +index 95aaa10..0172419 100644 +--- a/src/pulsecore/core-scache.c ++++ b/src/pulsecore/core-scache.c +@@ -351,7 +351,12 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t + if (p) + pa_proplist_update(merged, PA_UPDATE_REPLACE, p); + +- if (pa_play_memchunk(sink, &e->sample_spec, &e->channel_map, &e->memchunk, pass_volume ? &r : NULL, merged, sink_input_idx) < 0) ++ if (pa_play_memchunk(sink, ++ &e->sample_spec, &e->channel_map, ++ &e->memchunk, ++ pass_volume ? &r : NULL, ++ merged, ++ PA_SINK_INPUT_NO_CREATE_ON_SUSPEND|PA_SINK_INPUT_KILL_ON_SUSPEND, sink_input_idx) < 0) + goto fail; + + pa_proplist_free(merged); +diff --git a/src/pulsecore/play-memblockq.c b/src/pulsecore/play-memblockq.c +index f528c49..0d6da3e 100644 +--- a/src/pulsecore/play-memblockq.c ++++ b/src/pulsecore/play-memblockq.c +@@ -173,7 +173,8 @@ pa_sink_input* pa_memblockq_sink_input_new( + const pa_channel_map *map, + pa_memblockq *q, + pa_cvolume *volume, +- pa_proplist *p) { ++ pa_proplist *p, ++ pa_sink_input_flags_t flags) { + + memblockq_stream *u = NULL; + pa_sink_input_new_data data; +@@ -198,6 +199,7 @@ pa_sink_input* pa_memblockq_sink_input_new( + pa_sink_input_new_data_set_channel_map(&data, map); + pa_sink_input_new_data_set_volume(&data, volume); + pa_proplist_update(data.proplist, PA_UPDATE_REPLACE, p); ++ data.flags |= flags; + + pa_sink_input_new(&u->sink_input, sink->core, &data); + pa_sink_input_new_data_done(&data); +@@ -237,6 +239,7 @@ int pa_play_memblockq( + pa_memblockq *q, + pa_cvolume *volume, + pa_proplist *p, ++ pa_sink_input_flags_t flags, + uint32_t *sink_input_index) { + + pa_sink_input *i; +@@ -245,7 +248,7 @@ int pa_play_memblockq( + pa_assert(ss); + pa_assert(q); + +- if (!(i = pa_memblockq_sink_input_new(sink, ss, map, q, volume, p))) ++ if (!(i = pa_memblockq_sink_input_new(sink, ss, map, q, volume, p, flags))) + return -1; + + pa_sink_input_put(i); +diff --git a/src/pulsecore/play-memblockq.h b/src/pulsecore/play-memblockq.h +index 9d5f40f..a55fed0 100644 +--- a/src/pulsecore/play-memblockq.h ++++ b/src/pulsecore/play-memblockq.h +@@ -31,17 +31,19 @@ pa_sink_input* pa_memblockq_sink_input_new( + const pa_channel_map *map, + pa_memblockq *q, + pa_cvolume *volume, +- pa_proplist *p); ++ pa_proplist *p, ++ pa_sink_input_flags_t flags); + + void pa_memblockq_sink_input_set_queue(pa_sink_input *i, pa_memblockq *q); + + int pa_play_memblockq( +- pa_sink *sink, +- const pa_sample_spec *ss, +- const pa_channel_map *map, +- pa_memblockq *q, +- pa_cvolume *cvolume, +- pa_proplist *p, +- uint32_t *sink_input_index); ++ pa_sink *sink, ++ const pa_sample_spec *ss, ++ const pa_channel_map *map, ++ pa_memblockq *q, ++ pa_cvolume *cvolume, ++ pa_proplist *p, ++ pa_sink_input_flags_t flags, ++ uint32_t *sink_input_index); + + #endif +diff --git a/src/pulsecore/play-memchunk.c b/src/pulsecore/play-memchunk.c +index 1a3bd5b..6fb8902 100644 +--- a/src/pulsecore/play-memchunk.c ++++ b/src/pulsecore/play-memchunk.c +@@ -43,6 +43,7 @@ int pa_play_memchunk( + const pa_memchunk *chunk, + pa_cvolume *volume, + pa_proplist *p, ++ pa_sink_input_flags_t flags, + uint32_t *sink_input_index) { + + pa_memblockq *q; +@@ -59,7 +60,7 @@ int pa_play_memchunk( + + pa_assert_se(pa_memblockq_push(q, chunk) >= 0); + +- if ((r = pa_play_memblockq(sink, ss, map, q, volume, p, sink_input_index)) < 0) { ++ if ((r = pa_play_memblockq(sink, ss, map, q, volume, p, flags, sink_input_index)) < 0) { + pa_memblockq_free(q); + return r; + } +diff --git a/src/pulsecore/play-memchunk.h b/src/pulsecore/play-memchunk.h +index c813611..068add1 100644 +--- a/src/pulsecore/play-memchunk.h ++++ b/src/pulsecore/play-memchunk.h +@@ -26,12 +26,13 @@ + #include + + int pa_play_memchunk( +- pa_sink *sink, +- const pa_sample_spec *ss, +- const pa_channel_map *map, +- const pa_memchunk *chunk, +- pa_cvolume *cvolume, +- pa_proplist *p, +- uint32_t *sink_input_index); ++ pa_sink *sink, ++ const pa_sample_spec *ss, ++ const pa_channel_map *map, ++ const pa_memchunk *chunk, ++ pa_cvolume *cvolume, ++ pa_proplist *p, ++ pa_sink_input_flags_t flags, ++ uint32_t *sink_input_index); + + #endif +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0055-pacat-pass-buffer_attr-to-recording-streams-too.patch b/srcpkgs/pulseaudio/patches/0055-pacat-pass-buffer_attr-to-recording-streams-too.patch new file mode 100644 index 00000000000..a3e4acccdaf --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0055-pacat-pass-buffer_attr-to-recording-streams-too.patch @@ -0,0 +1,28 @@ +From b2e9fb6f6e12a3eab8a41c67017507e60d616e2a Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Sun, 21 Feb 2010 21:09:26 +0100 +Subject: [PATCH 55/62] pacat: pass buffer_attr to recording streams too + +Pointed out by Colin Guthrie. + +https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-February/006698.html +--- + src/utils/pacat.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/utils/pacat.c b/src/utils/pacat.c +index d136f6b..394cfbf 100644 +--- a/src/utils/pacat.c ++++ b/src/utils/pacat.c +@@ -473,7 +473,7 @@ static void context_state_callback(pa_context *c, void *userdata) { + } + + } else { +- if (pa_stream_connect_record(stream, device, latency > 0 ? &buffer_attr : NULL, flags) < 0) { ++ if (pa_stream_connect_record(stream, device, &buffer_attr, flags) < 0) { + pa_log(_("pa_stream_connect_record() failed: %s"), pa_strerror(pa_context_errno(c))); + goto fail; + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0056-suspend-on-idle-resume-audio-device-even-for-initial.patch b/srcpkgs/pulseaudio/patches/0056-suspend-on-idle-resume-audio-device-even-for-initial.patch new file mode 100644 index 00000000000..08ff9099d64 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0056-suspend-on-idle-resume-audio-device-even-for-initial.patch @@ -0,0 +1,47 @@ +From a469d44e6993c4e9e7a53ac91ed53eacb500e279 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 22 Feb 2010 03:22:28 +0100 +Subject: [PATCH 56/62] suspend-on-idle: resume audio device even for initially corked streams + +We need to resume audio devices even for streams that are created in +corked stat, so that the latency ranges of the audio device are known +during the initial latency negotiation. If we don't the latency +negotiation will be based on placeholder data and changed later on which +clients do not expect. + +This should fix issues with Skype. + +https://bugzilla.redhat.com/show_bug.cgi?id=554929 +--- + src/modules/module-suspend-on-idle.c | 8 +++----- + 1 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c +index 7adaa0b..cfb7879 100644 +--- a/src/modules/module-suspend-on-idle.c ++++ b/src/modules/module-suspend-on-idle.c +@@ -145,8 +145,9 @@ static pa_hook_result_t sink_input_fixate_hook_cb(pa_core *c, pa_sink_input_new_ + pa_assert(data); + pa_assert(u); + +- if (data->flags & PA_SINK_INPUT_START_CORKED) +- return PA_HOOK_OK; ++ /* We need to resume the audio device here even for ++ * PA_SINK_INPUT_START_CORKED, since we need the device parameters ++ * to be fully available while the stream is set up. */ + + if ((d = pa_hashmap_get(u->device_infos, data->sink))) + resume(d); +@@ -161,9 +162,6 @@ static pa_hook_result_t source_output_fixate_hook_cb(pa_core *c, pa_source_outpu + pa_assert(data); + pa_assert(u); + +- if (data->flags & PA_SOURCE_OUTPUT_START_CORKED) +- return PA_HOOK_OK; +- + if (data->source->monitor_of) + d = pa_hashmap_get(u->device_infos, data->source->monitor_of); + else +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0057-native-improve-logging-for-buffer_attrs.patch b/srcpkgs/pulseaudio/patches/0057-native-improve-logging-for-buffer_attrs.patch new file mode 100644 index 00000000000..fa971fc54b8 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0057-native-improve-logging-for-buffer_attrs.patch @@ -0,0 +1,48 @@ +From 4a32103d84102ee91368eed1f30613de6da12f6a Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 22 Feb 2010 03:40:29 +0100 +Subject: [PATCH 57/62] native: improve logging for buffer_attrs + +--- + src/pulsecore/protocol-native.c | 18 ++++++++++++++++++ + 1 files changed, 18 insertions(+), 0 deletions(-) + +diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c +index f80b0c2..337869d 100644 +--- a/src/pulsecore/protocol-native.c ++++ b/src/pulsecore/protocol-native.c +@@ -858,6 +858,18 @@ static void fix_playback_buffer_attr(playback_stream *s) { + + pa_assert(s); + ++ /* pa_log("Client requested: maxlength=%li bytes tlength=%li bytes minreq=%li bytes prebuf=%li bytes", */ ++ /* (long) s->buffer_attr.maxlength, */ ++ /* (long) s->buffer_attr.tlength, */ ++ /* (long) s->buffer_attr.minreq, */ ++ /* (long) s->buffer_attr.prebuf); */ ++ ++ /* pa_log("Client requested: maxlength=%lu ms tlength=%lu ms minreq=%lu ms prebuf=%lu ms", */ ++ /* (unsigned long) (pa_bytes_to_usec(s->buffer_attr.maxlength, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC), */ ++ /* (unsigned long) (pa_bytes_to_usec(s->buffer_attr.tlength, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC), */ ++ /* (unsigned long) (pa_bytes_to_usec(s->buffer_attr.minreq, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC), */ ++ /* (unsigned long) (pa_bytes_to_usec(s->buffer_attr.prebuf, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC)); */ ++ + /* This function will be called from the main thread, before as + * well as after the sink input has been activated using + * pa_sink_input_put()! That means it may not touch any +@@ -984,6 +996,12 @@ static void fix_playback_buffer_attr(playback_stream *s) { + if (s->buffer_attr.prebuf == (uint32_t) -1 || + s->buffer_attr.prebuf > max_prebuf) + s->buffer_attr.prebuf = max_prebuf; ++ ++ /* pa_log("Client accepted: maxlength=%lu ms tlength=%lu ms minreq=%lu ms prebuf=%lu ms", */ ++ /* (unsigned long) (pa_bytes_to_usec(s->buffer_attr.maxlength, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC), */ ++ /* (unsigned long) (pa_bytes_to_usec(s->buffer_attr.tlength, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC), */ ++ /* (unsigned long) (pa_bytes_to_usec(s->buffer_attr.minreq, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC), */ ++ /* (unsigned long) (pa_bytes_to_usec(s->buffer_attr.prebuf, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC)); */ + } + + /* Called from main context */ +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0058-alsa-util-strip-spaces-from-ALSA-card-pcm-names.patch b/srcpkgs/pulseaudio/patches/0058-alsa-util-strip-spaces-from-ALSA-card-pcm-names.patch new file mode 100644 index 00000000000..50439fd292c --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0058-alsa-util-strip-spaces-from-ALSA-card-pcm-names.patch @@ -0,0 +1,53 @@ +From 522c446ddc2bf2f4467f9de16f8618fc544a94fe Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Sun, 21 Feb 2010 22:00:49 +0100 +Subject: [PATCH 58/62] alsa-util: strip spaces from ALSA card/pcm names + +http://pulseaudio.org/ticket/778 +--- + src/modules/alsa/alsa-util.c | 12 +++++++----- + 1 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c +index 52f1259..1cbb3f3 100644 +--- a/src/modules/alsa/alsa-util.c ++++ b/src/modules/alsa/alsa-util.c +@@ -874,12 +874,12 @@ void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) { + pa_proplist_setf(p, "alsa.card", "%i", card); + + if (snd_card_get_name(card, &cn) >= 0) { +- pa_proplist_sets(p, "alsa.card_name", cn); ++ pa_proplist_sets(p, "alsa.card_name", pa_strip(cn)); + free(cn); + } + + if (snd_card_get_longname(card, &lcn) >= 0) { +- pa_proplist_sets(p, "alsa.long_card_name", lcn); ++ pa_proplist_sets(p, "alsa.long_card_name", pa_strip(lcn)); + free(lcn); + } + +@@ -937,8 +937,11 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t * + if (alsa_subclass_table[subclass]) + pa_proplist_sets(p, "alsa.subclass", alsa_subclass_table[subclass]); + +- if ((n = snd_pcm_info_get_name(pcm_info))) +- pa_proplist_sets(p, "alsa.name", n); ++ if ((n = snd_pcm_info_get_name(pcm_info))) { ++ char *t = pa_xstrdup(n); ++ pa_proplist_sets(p, "alsa.name", pa_strip(t)); ++ pa_xfree(t); ++ } + + if ((id = snd_pcm_info_get_id(pcm_info))) + pa_proplist_sets(p, "alsa.id", id); +@@ -1331,6 +1334,5 @@ pa_bool_t pa_alsa_may_tsched(pa_bool_t want) { + return FALSE; + } + +- + return TRUE; + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0059-alsa-reset-max_rewind-max_request-while-suspending.patch b/srcpkgs/pulseaudio/patches/0059-alsa-reset-max_rewind-max_request-while-suspending.patch new file mode 100644 index 00000000000..2931eddd0f0 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0059-alsa-reset-max_rewind-max_request-while-suspending.patch @@ -0,0 +1,48 @@ +From dd682d6f96fe7133b866c97b72edcb6136a9737c Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 22 Feb 2010 04:54:24 +0100 +Subject: [PATCH 59/62] alsa: reset max_rewind/max_request while suspending + +--- + src/modules/alsa/alsa-sink.c | 11 ++++++++++- + 1 files changed, 10 insertions(+), 1 deletions(-) + +diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c +index 690480f..60c10c4 100644 +--- a/src/modules/alsa/alsa-sink.c ++++ b/src/modules/alsa/alsa-sink.c +@@ -79,7 +79,7 @@ + #define TSCHED_MIN_WAKEUP_USEC (4*PA_USEC_PER_MSEC) /* 4ms -- Wakeup at least this long before the buffer runs empty*/ + + #define SMOOTHER_MIN_INTERVAL (2*PA_USEC_PER_MSEC) /* 2ms -- min smoother update interval */ +-#define SMOOTHER_MAX_INTERVAL (200*PA_USEC_PER_MSEC) /* 200ms -- max smoother update inteval */ ++#define SMOOTHER_MAX_INTERVAL (200*PA_USEC_PER_MSEC) /* 200ms -- max smoother update interval */ + + #define VOLUME_ACCURACY (PA_VOLUME_NORM/100) /* don't require volume adjustments to be perfectly correct. don't necessarily extend granularity in software unless the differences get greater than this level */ + +@@ -876,6 +876,14 @@ static int suspend(struct userdata *u) { + u->alsa_rtpoll_item = NULL; + } + ++ /* We reset max_rewind/max_request here to make sure that while we ++ * are suspended the old max_request/max_rewind values set before ++ * the suspend can influence the per-stream buffer of newly ++ * created streams, without their requirements having any ++ * influence on them. */ ++ pa_sink_set_max_rewind_within_thread(u->sink, 0); ++ pa_sink_set_max_request_within_thread(u->sink, 0); ++ + pa_log_info("Device suspended..."); + + return 0; +@@ -933,6 +941,7 @@ static int update_sw_params(struct userdata *u) { + } + + pa_sink_set_max_request_within_thread(u->sink, u->hwbuf_size - u->hwbuf_unused); ++ pa_sink_set_max_rewind_within_thread(u->sink, u->hwbuf_size); + + return 0; + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0060-core-util-introduce-generic-function-pa_strip.patch b/srcpkgs/pulseaudio/patches/0060-core-util-introduce-generic-function-pa_strip.patch new file mode 100644 index 00000000000..9e7b01a4692 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0060-core-util-introduce-generic-function-pa_strip.patch @@ -0,0 +1,78 @@ +From 195069c1815a1483b2c44f8cc72e2dd25e9b8fb1 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Sun, 21 Feb 2010 21:59:53 +0100 +Subject: [PATCH 60/62] core-util: introduce generic function pa_strip() + +--- + src/pulsecore/core-util.c | 28 ++++++++++++++++++++++++---- + src/pulsecore/core-util.h | 1 + + 2 files changed, 25 insertions(+), 4 deletions(-) + +diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c +index 258e8ee..d6017b9 100644 +--- a/src/pulsecore/core-util.c ++++ b/src/pulsecore/core-util.c +@@ -126,6 +126,9 @@ + #define MSG_NOSIGNAL 0 + #endif + ++#define NEWLINE "\r\n" ++#define WHITESPACE "\n\r \t" ++ + static pa_strlist *recorded_env = NULL; + + #ifdef OS_IS_WIN32 +@@ -830,9 +833,6 @@ char *pa_split(const char *c, const char *delimiter, const char**state) { + return pa_xstrndup(current, l); + } + +-/* What is interpreted as whitespace? */ +-#define WHITESPACE " \t\n" +- + /* Split a string into words. Otherwise similar to pa_split(). */ + char *pa_split_spaces(const char *c, const char **state) { + const char *current = *state ? *state : c; +@@ -1189,7 +1189,27 @@ int pa_lock_fd(int fd, int b) { + char* pa_strip_nl(char *s) { + pa_assert(s); + +- s[strcspn(s, "\r\n")] = 0; ++ s[strcspn(s, NEWLINE)] = 0; ++ return s; ++} ++ ++char *pa_strip(char *s) { ++ char *e, *l = NULL; ++ ++ /* Drops trailing whitespace. Modifies the string in ++ * place. Returns pointer to first non-space character */ ++ ++ s += strspn(s, WHITESPACE); ++ ++ for (e = s; *e; e++) ++ if (!strchr(WHITESPACE, *e)) ++ l = e; ++ ++ if (l) ++ *(l+1) = 0; ++ else ++ *s = 0; ++ + return s; + } + +diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h +index eba1b40..71be9de 100644 +--- a/src/pulsecore/core-util.h ++++ b/src/pulsecore/core-util.h +@@ -102,6 +102,7 @@ char *pa_split(const char *c, const char*delimiters, const char **state); + char *pa_split_spaces(const char *c, const char **state); + + char *pa_strip_nl(char *s); ++char *pa_strip(char *s); + + const char *pa_sig2str(int sig) PA_GCC_PURE; + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0061-esd-simple-use-pa_memblockq_pop_missing.patch b/srcpkgs/pulseaudio/patches/0061-esd-simple-use-pa_memblockq_pop_missing.patch new file mode 100644 index 00000000000..19fd57b14d3 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0061-esd-simple-use-pa_memblockq_pop_missing.patch @@ -0,0 +1,46 @@ +From 30f28ebf3619a86b49009e8dbce154233f597dbb Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 23 Feb 2010 00:48:35 +0100 +Subject: [PATCH 61/62] esd,simple: use pa_memblockq_pop_missing() + +We need to use pa_memblockq_pop_missing() for all request handling, +including the initial request, because otherwise the counters will be +stay off during the entire runtime. + +This should fix: + +https://bugzilla.redhat.com/show_bug.cgi?id=559467 +--- + src/pulsecore/protocol-esound.c | 2 +- + src/pulsecore/protocol-simple.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c +index a89f327..1e16334 100644 +--- a/src/pulsecore/protocol-esound.c ++++ b/src/pulsecore/protocol-esound.c +@@ -462,7 +462,7 @@ static int esd_proto_stream_play(connection *c, esd_proto_t request, const void + + c->protocol->n_player++; + +- pa_atomic_store(&c->playback.missing, (int) pa_memblockq_missing(c->input_memblockq)); ++ pa_atomic_store(&c->playback.missing, (int) pa_memblockq_pop_missing(c->input_memblockq)); + + pa_sink_input_put(c->sink_input); + +diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c +index fb2e564..77277e1 100644 +--- a/src/pulsecore/protocol-simple.c ++++ b/src/pulsecore/protocol-simple.c +@@ -574,7 +574,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp + + pa_iochannel_socket_set_rcvbuf(io, l); + +- pa_atomic_store(&c->playback.missing, (int) pa_memblockq_missing(c->input_memblockq)); ++ pa_atomic_store(&c->playback.missing, (int) pa_memblockq_pop_missing(c->input_memblockq)); + + pa_sink_input_put(c->sink_input); + } +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0062-core-rework-how-stream-volumes-affect-sink-volumes.patch b/srcpkgs/pulseaudio/patches/0062-core-rework-how-stream-volumes-affect-sink-volumes.patch new file mode 100644 index 00000000000..6197e5e1a88 --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0062-core-rework-how-stream-volumes-affect-sink-volumes.patch @@ -0,0 +1,72 @@ +From 0d1154d078f8f149e2ab9a67b09835a829416e49 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 23 Feb 2010 18:41:18 +0100 +Subject: [PATCH 62/62] core: rework how stream volumes affect sink volumes + +--- + src/pulsecore/sink.c | 42 +++++++++++++++++++++++++++++++++++++++++- + 1 files changed, 41 insertions(+), 1 deletions(-) + +diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c +index e6d718f..3a92f67 100644 +--- a/src/pulsecore/sink.c ++++ b/src/pulsecore/sink.c +@@ -1162,6 +1162,46 @@ pa_usec_t pa_sink_get_latency_within_thread(pa_sink *s) { + return usec; + } + ++static pa_cvolume* cvolume_remap_minimal_impact( ++ pa_cvolume *v, ++ const pa_cvolume *template, ++ const pa_channel_map *from, ++ const pa_channel_map *to) { ++ ++ pa_cvolume t; ++ ++ pa_assert(v); ++ pa_assert(template); ++ pa_assert(from); ++ pa_assert(to); ++ ++ pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(v, from), NULL); ++ pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(template, to), NULL); ++ ++ /* Much like pa_cvolume_remap(), but tries to minimize impact when ++ * mapping from sink input to sink volumes: ++ * ++ * If template is a possible remapping from v it is used instead ++ * of remapping anew. ++ * ++ * If the channel maps don't match we set an all-channel volume on ++ * the sink to ensure that changing a volume on one stream has no ++ * effect that cannot be compensated for in another stream that ++ * does not have the same channel map as the sink. */ ++ ++ if (pa_channel_map_equal(from, to)) ++ return v; ++ ++ t = *template; ++ if (pa_cvolume_equal(pa_cvolume_remap(&t, to, from), v)) { ++ *v = *template; ++ return v; ++ } ++ ++ pa_cvolume_set(v, to->channels, pa_cvolume_max(v)); ++ return v; ++} ++ + /* Called from main context */ + static void compute_reference_ratios(pa_sink *s) { + uint32_t idx; +@@ -1289,7 +1329,7 @@ static void compute_real_volume(pa_sink *s) { + pa_cvolume remapped; + + remapped = i->volume; +- pa_cvolume_remap(&remapped, &i->channel_map, &s->channel_map); ++ cvolume_remap_minimal_impact(&remapped, &s->real_volume, &i->channel_map, &s->channel_map); + pa_cvolume_merge(&s->real_volume, &s->real_volume, &remapped); + } + +-- +1.7.0 + diff --git a/srcpkgs/pulseaudio/patches/0063-legacy-dir.patch b/srcpkgs/pulseaudio/patches/0063-legacy-dir.patch new file mode 100644 index 00000000000..98a727f3a1e --- /dev/null +++ b/srcpkgs/pulseaudio/patches/0063-legacy-dir.patch @@ -0,0 +1,11 @@ +--- pulseaudio-0.9.21/src/pulse/context.c-orig 2010-09-29 08:56:41.000000000 +0200 ++++ pulseaudio-0.9.21/src/pulse/context.c 2010-09-29 13:04:15.000000000 +0200 +@@ -624,7 +624,7 @@ static pa_strlist *prepend_per_user(pa_s + char *ufn; + + #ifdef ENABLE_LEGACY_RUNTIME_DIR +- static char *legacy_dir; ++ char *legacy_dir; + + /* The very old per-user instance path (< 0.9.11). This is supported only to ease upgrades */ + if ((legacy_dir = get_very_old_legacy_runtime_dir())) { diff --git a/srcpkgs/pulseaudio/pulseaudio-devel.template b/srcpkgs/pulseaudio/pulseaudio-devel.template index bbe9ffb7a77..bf1e8338e38 100644 --- a/srcpkgs/pulseaudio/pulseaudio-devel.template +++ b/srcpkgs/pulseaudio/pulseaudio-devel.template @@ -8,7 +8,7 @@ long_desc=" This package contains files for development, headers, static libs, etc." -revision=1 +revision=2 Add_dependency run pkg-config Add_dependency run gettext diff --git a/srcpkgs/pulseaudio/template b/srcpkgs/pulseaudio/template index 7903cecb9e3..ca3d7b8a43e 100644 --- a/srcpkgs/pulseaudio/template +++ b/srcpkgs/pulseaudio/template @@ -1,7 +1,8 @@ # Template file for 'pulseaudio' pkgname=pulseaudio version=0.9.21 -revision=3 +revision=4 +patch_args="-Np1" distfiles="http://0pointer.de/lennart/projects/$pkgname/$pkgname-$version.tar.gz" build_style=gnu_configure configure_args="--disable-samplerate --disable-oss-output --disable-oss-wrapper @@ -67,6 +68,7 @@ Add_dependency run GConf Add_dependency run libpulseaudio Add_dependency build pkg-config +Add_dependency build automake Add_dependency build gettext Add_dependency build GConf-devel Add_dependency build glib-devel @@ -91,6 +93,11 @@ Add_dependency build zlib-devel Add_dependency full rtkit +pre_configure() +{ + cd ${wrksrc} && autoreconf -fi +} + post_install() { install -Dm755 ${FILESDIR}/pulseaudio.xinit \