[pulseaudio-discuss] [PATCH] alsa-sink/source: Better thread names
David Henningsson
david.henningsson at canonical.com
Fri Dec 14 07:03:36 PST 2012
Now you can actually see *which* sink/source that sends a specific
message to the log, which is quite useful if you have more than
one sound card.
Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---
Nothing to delay a release for, so just put it in Tanu's or Arun's
"next" branches.
src/modules/alsa/alsa-sink.c | 7 ++++++-
src/modules/alsa/alsa-source.c | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index ed41b22..2a48152 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1995,6 +1995,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
struct userdata *u = NULL;
const char *dev_id = NULL, *key, *mod_name;
pa_sample_spec ss;
+ char *thread_name = NULL;
uint32_t alternate_sample_rate;
pa_channel_map map;
uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark, rewind_safeguard;
@@ -2341,10 +2342,13 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
pa_alsa_dump(PA_LOG_DEBUG, u->pcm_handle);
- if (!(u->thread = pa_thread_new("alsa-sink", thread_func, u))) {
+ thread_name = pa_sprintf_malloc("alsa-sink-%s", pa_strnull(pa_proplist_gets(u->sink->proplist, "alsa.id")));
+ if (!(u->thread = pa_thread_new(thread_name, thread_func, u))) {
pa_log("Failed to create thread.");
goto fail;
}
+ pa_xfree(thread_name);
+ thread_name = NULL;
/* Get initial mixer settings */
if (data.volume_is_set) {
@@ -2389,6 +2393,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
return u->sink;
fail:
+ pa_xfree(thread_name);
if (u)
userdata_free(u);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 9f3170d..e1a5b1e 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1726,6 +1726,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
struct userdata *u = NULL;
const char *dev_id = NULL, *key, *mod_name;
pa_sample_spec ss;
+ char *thread_name = NULL;
uint32_t alternate_sample_rate;
pa_channel_map map;
uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark;
@@ -2053,10 +2054,13 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
pa_alsa_dump(PA_LOG_DEBUG, u->pcm_handle);
- if (!(u->thread = pa_thread_new("alsa-source", thread_func, u))) {
+ thread_name = pa_sprintf_malloc("alsa-source-%s", pa_strnull(pa_proplist_gets(u->source->proplist, "alsa.id")));
+ if (!(u->thread = pa_thread_new(thread_name, thread_func, u))) {
pa_log("Failed to create thread.");
goto fail;
}
+ pa_xfree(thread_name);
+ thread_name = NULL;
/* Get initial mixer settings */
if (data.volume_is_set) {
@@ -2086,6 +2090,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
return u->source;
fail:
+ pa_xfree(thread_name);
if (u)
userdata_free(u);
--
1.7.9.5
More information about the pulseaudio-discuss
mailing list