From b69d6d0aa9c9887a9c6008863ff8194dc3921ac5 Mon Sep 17 00:00:00 2001 From: Seungbae Shin Date: Fri, 1 Oct 2021 21:09:58 +0900 Subject: [PATCH] core, sink-input: dump sink-input info when it exceeds the maximum connection + fix minor warning [Version] 13.0-36 [Issue Type] Debugging Change-Id: Ia33d4fc0507630576b1305acff64633853a99de3 --- packaging/pulseaudio.spec | 2 +- src/pulsecore/core-util.h | 3 +++ src/pulsecore/core.c | 12 ++++++++++++ src/pulsecore/core.h | 4 ++++ src/pulsecore/sink-input.c | 19 +++++++++++++++++++ src/pulsecore/sink-input.h | 1 + 6 files changed, 40 insertions(+), 1 deletion(-) diff --git a/packaging/pulseaudio.spec b/packaging/pulseaudio.spec index fc319a7..9f97e11 100644 --- a/packaging/pulseaudio.spec +++ b/packaging/pulseaudio.spec @@ -3,7 +3,7 @@ Name: pulseaudio Summary: Improved Linux sound server Version: 13.0 -Release: 35 +Release: 36 Group: Multimedia/Audio License: LGPL-2.1 URL: http://pulseaudio.org diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h index cfb9eb2..498a1ce 100644 --- a/src/pulsecore/core-util.h +++ b/src/pulsecore/core-util.h @@ -200,6 +200,9 @@ static inline unsigned pa_make_power_of_two(unsigned n) { return 1U << (pa_ulog2(n) + 1); } +#ifdef __TIZEN_ +int pa_safe_close_pipe(int fd); +#endif void pa_close_pipe(int fds[2]); char *pa_readlink(const char *p); diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index eca2dde..c263c69 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -565,3 +565,15 @@ const char *pa_suspend_cause_to_string(pa_suspend_cause_t cause_bitfield, char b return buf; } + +#ifdef __TIZEN__ +void pa_core_dump_sink_inputs(pa_core *core) { + pa_sink_input *si = NULL; + uint32_t idx = 0; + + pa_log_warn(">> Start dumping (%u) sink-inputs", pa_idxset_size(core->sink_inputs)); + PA_IDXSET_FOREACH(si, core->sink_inputs, idx) + pa_sink_input_dump_info(si); + pa_log_warn("<< Dump finished!"); +} +#endif \ No newline at end of file diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h index 2d9c27d..7e367fc 100644 --- a/src/pulsecore/core.h +++ b/src/pulsecore/core.h @@ -298,4 +298,8 @@ static const size_t PA_SUSPEND_CAUSE_TO_STRING_BUF_SIZE = * provided buffer. The same buffer is the return value of this function. */ const char *pa_suspend_cause_to_string(pa_suspend_cause_t cause, char buf[PA_SUSPEND_CAUSE_TO_STRING_BUF_SIZE]); +#ifdef __TIZEN__ +void pa_core_dump_sink_inputs(pa_core *core); +#endif + #endif diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 6edf57f..7d41377 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -572,6 +572,9 @@ int pa_sink_input_new( if (pa_idxset_size(data->sink->inputs) >= PA_MAX_INPUTS_PER_SINK) { pa_log_warn("Failed to create sink input: too many inputs per sink."); +#ifdef __TIZEN__ + pa_core_dump_sink_inputs(core); +#endif return -PA_ERR_TOOLARGE; } @@ -2858,3 +2861,19 @@ void pa_sink_input_set_reference_ratio(pa_sink_input *i, const pa_cvolume *ratio pa_cvolume_snprint_verbose(old_ratio_str, sizeof(old_ratio_str), &old_ratio, &i->channel_map, true), pa_cvolume_snprint_verbose(new_ratio_str, sizeof(new_ratio_str), ratio, &i->channel_map, true)); } + +#ifdef __TIZEN__ +void pa_sink_input_dump_info(pa_sink_input *i) { + pa_assert(i); + + pa_log_warn("#%4u: client(%5d), sink(%2u), state(%d), muted(%d), app(pid:%s, org:%s, binary:%s), media(name:%s, role:%s)", + i->index, + i->client ? (int)i->client->index : -1, + i->sink->index, i->state, i->muted, + pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_PROCESS_ID), + pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_PROCESS_ID_ORIGIN), + pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_PROCESS_BINARY), + pa_proplist_gets(i->proplist, PA_PROP_MEDIA_NAME), + pa_proplist_gets(i->proplist, PA_PROP_MEDIA_ROLE)); +} +#endif \ No newline at end of file diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h index f6aad84..f12e09f 100644 --- a/src/pulsecore/sink-input.h +++ b/src/pulsecore/sink-input.h @@ -501,6 +501,7 @@ void pa_sink_input_set_reference_ratio(pa_sink_input *i, const pa_cvolume *ratio #ifdef __TIZEN__ void pa_sink_input_update_empty_pop(pa_sink_input *i, size_t length, bool *is_timeout); +void pa_sink_input_dump_info(pa_sink_input *i); #endif #define pa_sink_input_assert_io_context(s) \ -- 2.7.4