From 63d943f697e585636cacc955fad9c852d1adfada Mon Sep 17 00:00:00 2001 From: zhanhang Date: Wed, 31 May 2023 19:43:43 +0800 Subject: [PATCH 1/2] change pa_log to hilog Signed-off-by: z00511616 --- src/pulsecore/core.c | 24 +++--- src/pulsecore/memblock.c | 19 +++-- src/pulsecore/protocol-native.c | 137 ++++++++++++++++---------------- src/pulsecore/shm.c | 30 +++---- 4 files changed, 105 insertions(+), 105 deletions(-) diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 44d48f715..95bce4a7f 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -75,8 +75,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, bool shared, bool enable_memfd, size_t if (shared) { type = (enable_memfd) ? PA_MEM_TYPE_SHARED_MEMFD : PA_MEM_TYPE_SHARED_POSIX; if (!(pool = pa_mempool_new(type, shm_size, false))) { - - pa_log_warn("Failed to allocate %s memory pool. Falling back to a normal memory pool.", + AUDIO_WARNING_LOG("Failed to allocate %{public}s memory pool. Falling back to a normal memory pool.", pa_mem_type_to_string(type)); shared = false; } @@ -84,7 +83,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, bool shared, bool enable_memfd, size_t if (!shared) { if (!(pool = pa_mempool_new(PA_MEM_TYPE_PRIVATE, shm_size, false))) { - pa_log("pa_mempool_new() failed."); + AUDIO_ERR_LOG("pa_mempool_new() failed."); return NULL; } } @@ -106,8 +105,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, bool shared, bool enable_memfd, size_t c->scache = pa_idxset_new(NULL, NULL); c->namereg = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); - c->shared = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); - c->message_handlers = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); + c->shared = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); c->message_handlers = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); c->default_source = NULL; c->default_sink = NULL; @@ -243,7 +241,7 @@ void pa_core_set_configured_default_sink(pa_core *core, const char *sink) { pa_xfree(core->configured_default_sink); core->configured_default_sink = pa_xstrdup(sink); - pa_log_info("configured_default_sink: %s -> %s", + AUDIO_INFO_LOG("configured_default_sink: %{public}s -> %{public}s", old_sink ? old_sink : "(unset)", sink ? sink : "(unset)"); pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX); @@ -265,7 +263,7 @@ void pa_core_set_configured_default_source(pa_core *core, const char *source) { pa_xfree(core->configured_default_source); core->configured_default_source = pa_xstrdup(source); - pa_log_info("configured_default_source: %s -> %s", + AUDIO_INFO_LOG("configured_default_source: %{public}s -> %{public}s", old_source ? old_source : "(unset)", source ? source : "(unset)"); pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX); @@ -340,7 +338,7 @@ void pa_core_update_default_sink(pa_core *core) { return; core->default_sink = best; - pa_log_info("default_sink: %s -> %s", + AUDIO_INFO_LOG("default_sink: %{public}s -> %{public}s", old_default_sink ? old_default_sink->name : "(unset)", best ? best->name : "(unset)"); /* If the default sink changed, it may be that the default source has to be @@ -431,7 +429,7 @@ void pa_core_update_default_source(pa_core *core) { return; core->default_source = best; - pa_log_info("default_source: %s -> %s", + AUDIO_INFO_LOG("default_source: %{public}s -> %{public}s", old_default_source ? old_default_source->name : "(unset)", best ? best->name : "(unset)"); pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX); pa_hook_fire(&core->hooks[PA_CORE_HOOK_DEFAULT_SOURCE_CHANGED], core->default_source); @@ -447,7 +445,7 @@ void pa_core_set_exit_idle_time(pa_core *core, int time) { if (time == core->exit_idle_time) return; - pa_log_info("exit_idle_time: %i -> %i", core->exit_idle_time, time); + AUDIO_INFO_LOG("exit_idle_time: %{public}i -> %{public}i", core->exit_idle_time, time); core->exit_idle_time = time; } @@ -455,7 +453,7 @@ static void exit_callback(pa_mainloop_api *m, pa_time_event *e, const struct tim pa_core *c = userdata; pa_assert(c->exit_event == e); - pa_log_info("We are idle, quitting..."); + AUDIO_INFO_LOG("We are idle, quitting..."); pa_core_exit(c, true, 0); } @@ -488,7 +486,7 @@ void pa_core_maybe_vacuum(pa_core *c) { pa_assert(c); if (pa_idxset_isempty(c->sink_inputs) && pa_idxset_isempty(c->source_outputs)) { - pa_log_debug("Hmm, no streams around, trying to vacuum."); + AUDIO_DEBUG_LOG("Hmm, no streams around, trying to vacuum."); } else { pa_sink *si; pa_source *so; @@ -504,7 +502,7 @@ void pa_core_maybe_vacuum(pa_core *c) { if (so->state != PA_SOURCE_SUSPENDED) return; - pa_log_info("All sinks and sources are suspended, vacuuming memory"); + AUDIO_INFO_LOG("All sinks and sources are suspended, vacuuming memory"); } pa_mempool_vacuum(c->mempool); diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c index f20174035..f47436666 100644 --- a/src/pulsecore/memblock.c +++ b/src/pulsecore/memblock.c @@ -310,7 +310,7 @@ static struct mempool_slot* mempool_allocate_slot(pa_mempool *p) { if (!slot) { if (pa_log_ratelimit(PA_LOG_DEBUG)) - pa_log_debug("Pool full"); + AUDIO_DEBUG_LOG("Pool full"); pa_atomic_inc(&p->stat.n_pool_full); return NULL; } @@ -405,7 +405,8 @@ pa_memblock *pa_memblock_new_pool(pa_mempool *p, size_t length) { pa_atomic_ptr_store(&b->data, mempool_slot_data(slot)); } else { - pa_log_debug("Memory block too large for pool: %lu > %lu", (unsigned long) length, (unsigned long) p->block_size); + AUDIO_DEBUG_LOG("Memory block too large for pool: %{public}lu > %{public}lu", + (unsigned long) length, (unsigned long) p->block_size); pa_atomic_inc(&p->stat.n_too_large_for_pool); return NULL; } @@ -854,7 +855,8 @@ pa_mempool *pa_mempool_new(pa_mem_type_t type, size_t size, bool per_client) { return NULL; } - pa_log_debug("Using %s memory pool with %u slots of size %s each, total size is %s, maximum usable slot size is %lu", + AUDIO_DEBUG_LOG("Using %{public}s memory pool with %{public}u slots of size %{public}s each, total size is" + "%{public}s, maximum usable slot size is %{public}lu", pa_mem_type_to_string(type), p->n_blocks, pa_bytes_snprint(t1, sizeof(t1), (unsigned) p->block_size), @@ -919,7 +921,7 @@ static void mempool_free(pa_mempool *p) { } if (!k) - pa_log("REF: Leaked memory block %p", b); + AUDIO_ERR_LOG("REF: Leaked memory block %{public}p", b); while ((k = pa_flist_pop(list))) while (pa_flist_push(p->free_slots, k) < 0) @@ -930,7 +932,8 @@ static void mempool_free(pa_mempool *p) { #endif - pa_log_error("Memory pool destroyed but not all memory blocks freed! %u remain.", pa_atomic_load(&p->stat.n_allocated)); + AUDIO_ERR_LOG("Memory pool destroyed but not all memory blocks freed! %{public}u remain.", + pa_atomic_load(&p->stat.n_allocated)); /* PA_DEBUG_TRAP; */ } @@ -1250,8 +1253,8 @@ pa_memblock* pa_memimport_get(pa_memimport *i, pa_mem_type_t type, uint32_t bloc if (!(seg = pa_hashmap_get(i->segments, PA_UINT32_TO_PTR(shm_id)))) { if (type == PA_MEM_TYPE_SHARED_MEMFD) { - pa_log("Bailing out! No cached memimport segment for memfd ID %u", shm_id); - pa_log("Did the other PA endpoint forget registering its memfd pool?"); + AUDIO_ERR_LOG("Bailing out! No cached memimport segment for memfd ID %{public}u", shm_id); + AUDIO_ERR_LOG("Did the other PA endpoint forget registering its memfd pool?"); goto finish; } @@ -1261,7 +1264,7 @@ pa_memblock* pa_memimport_get(pa_memimport *i, pa_mem_type_t type, uint32_t bloc } if (writable && !seg->writable) { - pa_log("Cannot import cached segment in write mode - previously mapped as read-only"); + AUDIO_ERR_LOG("Cannot import cached segment in write mode - previously mapped as read-only"); goto finish; } diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index 4aac09db6..1dd8d2d36 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -458,7 +458,7 @@ static void fix_record_buffer_attr_pre(record_stream *s) { * guarantee it. */ if (fragsize_usec != s->configured_source_latency) - pa_log_debug("Could not configure a sufficiently low latency. Early requests might not be satisfied."); + AUDIO_DEBUG_LOG("Could not configure a sufficiently low latency. Early requests might not be satisfied."); } else if (s->adjust_latency) { @@ -608,7 +608,7 @@ static record_stream* record_stream_new( pa_idxset_put(c->record_streams, s, &s->index); - pa_log_info("Final latency %0.2f ms = %0.2f ms + %0.2f ms", + AUDIO_INFO_LOG("Final latency %{public}0.2f ms = %{public}0.2f ms + %{public}0.2f ms", ((double) pa_bytes_to_usec(s->buffer_attr.fragsize, &source_output->sample_spec) + (double) s->configured_source_latency) / PA_USEC_PER_MSEC, (double) pa_bytes_to_usec(s->buffer_attr.fragsize, &source_output->sample_spec) / PA_USEC_PER_MSEC, (double) s->configured_source_latency / PA_USEC_PER_MSEC); @@ -778,7 +778,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { pa_assert(s); #ifdef PROTOCOL_NATIVE_DEBUG - pa_log("Client requested: maxlength=%li bytes tlength=%li bytes minreq=%li bytes prebuf=%li bytes", + AUDIO_DEBUG_LOG("Client requested: maxlength=%li bytes tlength=%li bytes minreq=%li bytes prebuf=%li bytes", (long) s->buffer_attr_req.maxlength, (long) s->buffer_attr_req.tlength, (long) s->buffer_attr_req.minreq, @@ -828,7 +828,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { orig_tlength_usec = tlength_usec = pa_bytes_to_usec(s->buffer_attr.tlength, &s->sink_input->sample_spec); orig_minreq_usec = minreq_usec = pa_bytes_to_usec(s->buffer_attr.minreq, &s->sink_input->sample_spec); - pa_log_info("Requested tlength=%0.2f ms, minreq=%0.2f ms", + AUDIO_INFO_LOG("Requested tlength=%{public}0.2f ms, minreq=%{public}0.2f ms", (double) tlength_usec / PA_USEC_PER_MSEC, (double) minreq_usec / PA_USEC_PER_MSEC); @@ -842,7 +842,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { * way it will have to query us at least that often. */ sink_usec = minreq_usec; - pa_log_debug("Early requests mode enabled, configuring sink latency to minreq."); + AUDIO_DEBUG_LOG("Early requests mode enabled, configuring sink latency to minreq."); } else if (s->adjust_latency) { @@ -868,7 +868,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { else sink_usec = 0; - pa_log_debug("Adjust latency mode enabled, configuring sink latency to half of overall latency."); + AUDIO_DEBUG_LOG("Adjust latency mode enabled, configuring sink latency to half of overall latency."); } else { @@ -881,7 +881,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { else sink_usec = 0; - pa_log_debug("Traditional mode enabled, modifying sink usec only for compat with minreq."); + AUDIO_DEBUG_LOG("Traditional mode enabled, modifying sink usec only for compat with minreq."); } s->configured_sink_latency = pa_sink_input_set_requested_latency(s->sink_input, sink_usec); @@ -893,7 +893,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { * guarantee it. */ if (minreq_usec != s->configured_sink_latency) - pa_log_debug("Could not configure a sufficiently low latency. Early requests might not be satisfied."); + AUDIO_DEBUG_LOG("Could not configure a sufficiently low latency. Early requests might not be satisfied."); } else if (s->adjust_latency) { @@ -905,7 +905,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { tlength_usec -= s->configured_sink_latency; } - pa_log_debug("Requested latency=%0.2f ms, Received latency=%0.2f ms", + AUDIO_DEBUG_LOG("Requested latency=%{public}0.2f ms, Received latency=%{public}0.2f ms", (double) sink_usec / PA_USEC_PER_MSEC, (double) s->configured_sink_latency / PA_USEC_PER_MSEC); @@ -1099,7 +1099,7 @@ static playback_stream* playback_stream_new( pa_idxset_put(c->output_streams, s, &s->index); - pa_log_info("Final latency %0.2f ms = %0.2f ms + 2*%0.2f ms + %0.2f ms", + AUDIO_INFO_LOG("Final latency %{public}0.2f ms = %{public}0.2f ms + 2*%{public}0.2f ms + %{public}0.2f ms", ((double) pa_bytes_to_usec(s->buffer_attr.tlength, &sink_input->sample_spec) + (double) s->configured_sink_latency) / PA_USEC_PER_MSEC, (double) pa_bytes_to_usec(s->buffer_attr.tlength-s->buffer_attr.minreq*2, &sink_input->sample_spec) / PA_USEC_PER_MSEC, (double) pa_bytes_to_usec(s->buffer_attr.minreq, &sink_input->sample_spec) / PA_USEC_PER_MSEC, @@ -1288,7 +1288,7 @@ static void handle_seek(playback_stream *s, int64_t indexw) { /* We just ended an underrun, let's ask the sink * for a complete rewind rewrite */ - pa_log_debug("Requesting rewind due to end of underrun."); + AUDIO_DEBUG_LOG("Requesting rewind due to end of underrun."); pa_sink_input_request_rewind(s->sink_input, (size_t) (s->sink_input->thread_info.underrun_for == (uint64_t) -1 ? 0 : s->sink_input->thread_info.underrun_for), @@ -1304,7 +1304,7 @@ static void handle_seek(playback_stream *s, int64_t indexw) { /* OK, the sink already asked for this data, so * let's have it ask us again */ - pa_log_debug("Requesting rewind due to rewrite."); + AUDIO_DEBUG_LOG("Requesting rewind due to rewrite."); pa_sink_input_request_rewind(s->sink_input, (size_t) (indexr - indexw), true, false, false); } } @@ -1342,7 +1342,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int if (chunk && pa_memblockq_push_align(s->memblockq, chunk) < 0) { if (pa_log_ratelimit(PA_LOG_WARN)) - pa_log_warn("Failed to push data into queue"); + AUDIO_WARNING_LOG("Failed to push data into queue"); pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_OVERFLOW, NULL, 0, NULL, NULL); pa_memblockq_seek(s->memblockq, (int64_t) chunk->length, PA_SEEK_RELATIVE, true); } @@ -1474,7 +1474,7 @@ static bool handle_input_underrun(playback_stream *s, bool force) { return false; if (!s->is_underrun) - pa_log_debug("%s %s of '%s'", force ? "Actual" : "Implicit", + AUDIO_DEBUG_LOG("%{public}s %{public}s of '%{public}s'", force ? "Actual" : "Implicit", s->drain_request ? "drain" : "underrun", pa_strnull(pa_proplist_gets(s->sink_input->proplist, PA_PROP_MEDIA_NAME))); send_drain = s->drain_request && (force || pa_sink_input_safe_to_remove(s->sink_input)); @@ -1482,7 +1482,7 @@ static bool handle_input_underrun(playback_stream *s, bool force) { if (send_drain) { s->drain_request = false; pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_DRAIN_ACK, PA_UINT_TO_PTR(s->drain_tag), 0, NULL, NULL); - pa_log_debug("Drain acknowledged of '%s'", pa_strnull(pa_proplist_gets(s->sink_input->proplist, PA_PROP_MEDIA_NAME))); + AUDIO_DEBUG_LOG("Drain acknowledged of '%{public}s'", pa_strnull(pa_proplist_gets(s->sink_input->proplist, PA_PROP_MEDIA_NAME))); } else if (!s->is_underrun) { pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_UNDERFLOW, NULL, pa_memblockq_get_read_index(s->memblockq), NULL, NULL); } @@ -1573,14 +1573,15 @@ static void sink_input_update_max_request_cb(pa_sink_input *i, size_t nbytes) { new_tlength = nbytes+2*pa_memblockq_get_minreq(s->memblockq); if (old_tlength < new_tlength) { - pa_log_debug("max_request changed, trying to update from %zu to %zu.", old_tlength, new_tlength); + AUDIO_DEBUG_LOG("max_request changed, trying to update from %{public}zu to %{public}zu.", old_tlength, + new_tlength); pa_memblockq_set_tlength(s->memblockq, new_tlength); new_tlength = pa_memblockq_get_tlength(s->memblockq); if (new_tlength == old_tlength) - pa_log_debug("Failed to increase tlength"); + AUDIO_DEBUG_LOG("Failed to increase tlength"); else { - pa_log_debug("Notifying client about increased tlength"); + AUDIO_DEBUG_LOG("Notifying client about increased tlength"); pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_UPDATE_TLENGTH, NULL, pa_memblockq_get_tlength(s->memblockq), NULL, NULL); } } @@ -2459,7 +2460,8 @@ static void command_exit(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta ret = pa_core_exit(c->protocol->core, false, 0); CHECK_VALIDITY(c->pstream, ret >= 0, tag, PA_ERR_ACCESS); - pa_log_debug("Client %s asks us to terminate.", pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_PROCESS_BINARY))); + AUDIO_DEBUG_LOG("Client %{public}s asks us to terminate.", pa_strnull(pa_proplist_gets(c->client->proplist, + PA_PROP_APPLICATION_PROCESS_BINARY))); pa_pstream_send_simple_ack(c->pstream, tag); /* nonsense */ } @@ -2472,33 +2474,33 @@ static void setup_srbchannel(pa_native_connection *c, pa_mem_type_t shm_type) { int fdlist[2]; AUDIO_INFO_LOG("start setup_srbchannel, shm_type: %{public}d", shm_type); #ifndef HAVE_CREDS - pa_log_debug("Disabling srbchannel, reason: No fd passing support"); + AUDIO_DEBUG_LOG("Disabling srbchannel, reason: No fd passing support"); return; #endif if (!c->options->srbchannel) { - pa_log_debug("Disabling srbchannel, reason: Must be enabled by module parameter"); + AUDIO_DEBUG_LOG("Disabling srbchannel, reason: Must be enabled by module parameter"); return; } if (c->version < 30) { - pa_log_debug("Disabling srbchannel, reason: Protocol too old"); + AUDIO_DEBUG_LOG("Disabling srbchannel, reason: Protocol too old"); return; } if (!pa_pstream_get_shm(c->pstream)) { - pa_log_debug("Disabling srbchannel, reason: No SHM support"); + AUDIO_DEBUG_LOG("Disabling srbchannel, reason: No SHM support"); return; } if (c->rw_mempool) { - pa_log_debug("Ignoring srbchannel setup, reason: received COMMAND_AUTH " + AUDIO_DEBUG_LOG("Ignoring srbchannel setup, reason: received COMMAND_AUTH " "more than once"); return; } if (!(c->rw_mempool = pa_mempool_new(shm_type, c->protocol->core->shm_size, true))) { - pa_log_warn("Disabling srbchannel, reason: Failed to allocate shared " + AUDIO_DEBUG_LOG("Disabling srbchannel, reason: Failed to allocate shared " "writable memory pool."); return; } @@ -2506,7 +2508,7 @@ static void setup_srbchannel(pa_native_connection *c, pa_mem_type_t shm_type) { if (shm_type == PA_MEM_TYPE_SHARED_MEMFD) { const char *reason; if (pa_pstream_register_memfd_mempool(c->pstream, c->rw_mempool, &reason)) { - pa_log_warn("Disabling srbchannel, reason: Failed to register memfd mempool: %s", reason); + AUDIO_WARNING_LOG("Disabling srbchannel, reason: Failed to register memfd mempool: %{public}s", reason); goto fail; } } @@ -2514,10 +2516,10 @@ static void setup_srbchannel(pa_native_connection *c, pa_mem_type_t shm_type) { srb = pa_srbchannel_new(c->protocol->core->mainloop, c->rw_mempool); if (!srb) { - pa_log_debug("Failed to create srbchannel"); + AUDIO_DEBUG_LOG("Failed to create srbchannel"); goto fail; } - pa_log_debug("Enabling srbchannel..."); + AUDIO_DEBUG_LOG("Enabling srbchannel..."); pa_srbchannel_export(srb, &srbt); /* Send enable command to client */ @@ -2552,7 +2554,7 @@ static void command_enable_srbchannel(pa_pdispatch *pd, uint32_t command, uint32 return; } - pa_log_debug("Client enabled srbchannel."); + AUDIO_DEBUG_LOG("Client enabled srbchannel."); pa_pstream_set_srbchannel(c->pstream, c->srbpending); c->srbpending = NULL; } @@ -2598,7 +2600,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta c->version &= PA_PROTOCOL_VERSION_MASK; } - pa_log_debug("Protocol version: remote %u, local %u", c->version, PA_PROTOCOL_VERSION); + AUDIO_DEBUG_LOG("Protocol version: remote %u, local %u", c->version, PA_PROTOCOL_VERSION); pa_proplist_setf(c->client->proplist, "native-protocol.version", "%u", c->version); @@ -2616,19 +2618,19 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta gid_t gid; if ((gid = pa_get_gid_of_group(c->options->auth_group)) == (gid_t) -1) - pa_log_warn("Failed to get GID of group '%s'", c->options->auth_group); + AUDIO_WARNING_LOG("Failed to get GID of group '%{public}s'", c->options->auth_group); else if (gid == creds->gid) success = true; if (!success) { if ((r = pa_uid_in_group(creds->uid, c->options->auth_group)) < 0) - pa_log_warn("Failed to check group membership."); + AUDIO_WARNING_LOG("Failed to check group membership."); else if (r > 0) success = true; } } - pa_log_info("Got credentials: uid=%lu gid=%lu success=%i", + AUDIO_INFO_LOG("Got credentials: uid=%{public}lu gid=%{public}lu success=%{public}i", (unsigned long) creds->uid, (unsigned long) creds->gid, (int) success); @@ -2644,7 +2646,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta } if (!success) { - pa_log_warn("Denied access to client with invalid authentication data."); + AUDIO_WARNING_LOG("Denied access to client with invalid authentication data."); pa_pstream_send_error(c->pstream, tag, PA_ERR_ACCESS); return; } @@ -2661,7 +2663,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta pa_mempool_is_shared(c->protocol->core->mempool) && c->is_local; - pa_log_debug("SHM possible: %s", pa_yes_no(do_shm)); + AUDIO_DEBUG_LOG("SHM possible: %{public}s", pa_yes_no(do_shm)); if (do_shm) if (c->version < 10 || (c->version >= 13 && !shm_on_remote)) @@ -2679,7 +2681,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta } #endif - pa_log_debug("Negotiated SHM: %s", pa_yes_no(do_shm)); + AUDIO_DEBUG_LOG("Negotiated SHM: %{public}s", pa_yes_no(do_shm)); pa_pstream_enable_shm(c->pstream, do_shm); /* Do not declare memfd support for 9.0 client libraries (protocol v31). @@ -2701,9 +2703,6 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta AUDIO_INFO_LOG("Memfd possible: %s", pa_yes_no(pa_memfd_is_locally_supported())); AUDIO_INFO_LOG("Negotiated SHM type: %s", pa_mem_type_to_string(shm_type)); - - pa_log_debug("Memfd possible: %s", pa_yes_no(pa_memfd_is_locally_supported())); - pa_log_debug("Negotiated SHM type: %s", pa_mem_type_to_string(shm_type)); } reply = reply_new(tag); @@ -3195,7 +3194,7 @@ static void sink_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sin if (c->version >= 15) { pa_tagstruct_put_volume(t, sink->base_volume); if (PA_UNLIKELY(sink->state == PA_SINK_INVALID_STATE)) - pa_log_error("Internal sink state is invalid."); + AUDIO_ERR_LOG("Internal sink state is invalid."); pa_tagstruct_putu32(t, sink->state); pa_tagstruct_putu32(t, sink->n_volume_steps); pa_tagstruct_putu32(t, sink->card ? sink->card->index : PA_INVALID_INDEX); @@ -3270,7 +3269,7 @@ static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_s if (c->version >= 15) { pa_tagstruct_put_volume(t, source->base_volume); if (PA_UNLIKELY(source->state == PA_SOURCE_INVALID_STATE)) - pa_log_error("Internal source state is invalid."); + AUDIO_ERR_LOG("Internal source state is invalid."); pa_tagstruct_putu32(t, source->state); pa_tagstruct_putu32(t, source->n_volume_steps); pa_tagstruct_putu32(t, source->card ? source->card->index : PA_INVALID_INDEX); @@ -3832,18 +3831,18 @@ static void command_set_volume( if (sink) { CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &sink->sample_spec), tag, PA_ERR_INVALID); - pa_log_debug("Client %s changes volume of sink %s.", client_name, sink->name); + AUDIO_DEBUG_LOG("Client %{public}s changes volume of sink %{public}s.", client_name, sink->name); pa_sink_set_volume(sink, &volume, true, true); } else if (source) { CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &source->sample_spec), tag, PA_ERR_INVALID); - pa_log_debug("Client %s changes volume of source %s.", client_name, source->name); + AUDIO_DEBUG_LOG("Client %{public}s changes volume of source %{public}s.", client_name, source->name); pa_source_set_volume(source, &volume, true, true); } else if (si) { CHECK_VALIDITY(c->pstream, si->volume_writable, tag, PA_ERR_BADSTATE); CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &si->sample_spec), tag, PA_ERR_INVALID); - pa_log_debug("Client %s changes volume of sink input %s.", + AUDIO_DEBUG_LOG("Client %{public}s changes volume of sink input %{public}s.", client_name, pa_strnull(pa_proplist_gets(si->proplist, PA_PROP_MEDIA_NAME))); pa_sink_input_set_volume(si, &volume, true, true); @@ -3851,7 +3850,7 @@ static void command_set_volume( CHECK_VALIDITY(c->pstream, so->volume_writable, tag, PA_ERR_BADSTATE); CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &so->sample_spec), tag, PA_ERR_INVALID); - pa_log_debug("Client %s changes volume of source output %s.", + AUDIO_DEBUG_LOG("Client %{public}s changes volume of source output %{public}s.", client_name, pa_strnull(pa_proplist_gets(so->proplist, PA_PROP_MEDIA_NAME))); pa_source_output_set_volume(so, &volume, true, true); @@ -3927,18 +3926,18 @@ static void command_set_mute( client_name = pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_PROCESS_BINARY)); if (sink) { - pa_log_debug("Client %s changes mute of sink %s.", client_name, sink->name); + AUDIO_DEBUG_LOG("Client %{public}s changes mute of sink %{public}s.", client_name, sink->name); pa_sink_set_mute(sink, mute, true); } else if (source) { - pa_log_debug("Client %s changes mute of source %s.", client_name, source->name); + AUDIO_DEBUG_LOG("Client %{public}s changes mute of source %{public}s.", client_name, source->name); pa_source_set_mute(source, mute, true); } else if (si) { - pa_log_debug("Client %s changes mute of sink input %s.", + AUDIO_DEBUG_LOG("Client %{public}s changes mute of sink input %{public}s.", client_name, pa_strnull(pa_proplist_gets(si->proplist, PA_PROP_MEDIA_NAME))); pa_sink_input_set_mute(si, mute, true); } else if (so) { - pa_log_debug("Client %s changes mute of source output %s.", + AUDIO_DEBUG_LOG("Client %{public}s changes mute of source output %{public}s.", client_name, pa_strnull(pa_proplist_gets(so->proplist, PA_PROP_MEDIA_NAME))); pa_source_output_set_mute(so, mute, true); @@ -4630,7 +4629,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa if (idx == PA_INVALID_INDEX && name && !*name) { - pa_log_debug("%s all sinks", b ? "Suspending" : "Resuming"); + AUDIO_DEBUG_LOG("%{public}s all sinks", b ? "Suspending" : "Resuming"); if (pa_sink_suspend_all(c->protocol->core, b, PA_SUSPEND_USER) < 0) { pa_pstream_send_error(c->pstream, tag, PA_ERR_INVALID); @@ -4646,7 +4645,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY); - pa_log_debug("%s of sink %s requested by client %" PRIu32 ".", + AUDIO_DEBUG_LOG("%{public}s of sink %{public}s requested by client %" PRIu32 ".", b ? "Suspending" : "Resuming", sink->name, c->client->index); if (pa_sink_suspend(sink, b, PA_SUSPEND_USER) < 0) { @@ -4660,7 +4659,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa if (idx == PA_INVALID_INDEX && name && !*name) { - pa_log_debug("%s all sources", b ? "Suspending" : "Resuming"); + AUDIO_DEBUG_LOG("%{public}s all sources", b ? "Suspending" : "Resuming"); if (pa_source_suspend_all(c->protocol->core, b, PA_SUSPEND_USER) < 0) { pa_pstream_send_error(c->pstream, tag, PA_ERR_INVALID); @@ -4677,7 +4676,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa CHECK_VALIDITY(c->pstream, source, tag, PA_ERR_NOENTITY); - pa_log_debug("%s of source %s requested by client %" PRIu32 ".", + AUDIO_DEBUG_LOG("%{public}s of source %{public}s requested by client %" PRIu32 ".", b ? "Suspending" : "Resuming", source->name, c->client->index); if (pa_source_suspend(source, b, PA_SUSPEND_USER) < 0) { @@ -4762,7 +4761,7 @@ static void command_set_card_profile(pa_pdispatch *pd, uint32_t command, uint32_ CHECK_VALIDITY(c->pstream, profile, tag, PA_ERR_NOENTITY); - pa_log_info("Application \"%s\" requests card profile change. card = %s, profile = %s", + AUDIO_INFO_LOG("Application \"%{public}s\" requests card profile change. card = %{public}s, profile = %{public}s", pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_NAME)), card->name, profile->name); @@ -5005,7 +5004,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o pa_native_connection_assert_ref(c); if (!(stream = OUTPUT_STREAM(pa_idxset_get_by_index(c->output_streams, channel)))) { - pa_log_debug("Client sent block for invalid stream."); + AUDIO_DEBUG_LOG("Client sent block for invalid stream."); /* Ignoring */ return; } @@ -5019,8 +5018,8 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o size_t frame_size = pa_frame_size(&ps->sink_input->sample_spec); if (chunk->index % frame_size != 0 || chunk->length % frame_size != 0) { - pa_log_warn("Client sent non-aligned memblock: index %d, length %d, frame size: %d", - (int) chunk->index, (int) chunk->length, (int) frame_size); + AUDIO_WARNING_LOG("Client sent non-aligned memblock: index %{public}d, length %{public}d, frame size:" + "%{public}d", (int) chunk->index, (int) chunk->length, (int) frame_size); return; } @@ -5084,7 +5083,7 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) { pa_native_connection_assert_ref(c); native_connection_unlink(c); - pa_log_info("Connection died."); + AUDIO_INFO_LOG("Connection died."); } static void pstream_drain_callback(pa_pstream *p, void *userdata) { @@ -5120,7 +5119,7 @@ static void client_kill_cb(pa_client *c) { pa_assert(c); native_connection_unlink(PA_NATIVE_CONNECTION(c->userdata)); - pa_log_info("Connection killed."); + AUDIO_INFO_LOG("Connection killed."); } static void client_send_event_cb(pa_client *client, const char*event, pa_proplist *pl) { @@ -5153,7 +5152,7 @@ static void auth_timeout(pa_mainloop_api*m, pa_time_event *e, const struct timev if (!c->authorized) { native_connection_unlink(c); - pa_log_info("Connection terminated due to authentication timeout."); + AUDIO_INFO_LOG("Connection terminated due to authentication timeout."); } } @@ -5168,7 +5167,7 @@ void pa_native_protocol_connect(pa_native_protocol *p, pa_iochannel *io, pa_nati pa_assert(o); if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) { - pa_log_warn("Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS); + AUDIO_WARNING_LOG("Warning! Too many connections (%{public}u), dropping incoming connection.", MAX_CONNECTIONS); pa_iochannel_free(io); return; } @@ -5194,7 +5193,7 @@ void pa_native_protocol_connect(pa_native_protocol *p, pa_iochannel *io, pa_nati c->srbpending = NULL; if (o->auth_anonymous) { - pa_log_info("Client authenticated anonymously."); + AUDIO_INFO_LOG("Client authenticated anonymously."); c->authorized = true; } @@ -5202,7 +5201,7 @@ void pa_native_protocol_connect(pa_native_protocol *p, pa_iochannel *io, pa_nati o->auth_ip_acl && pa_ip_acl_check(o->auth_ip_acl, pa_iochannel_get_recv_fd(io)) > 0) { - pa_log_info("Client authenticated by IP ACL."); + AUDIO_INFO_LOG("Client authenticated by IP ACL."); c->authorized = true; } @@ -5426,18 +5425,18 @@ int pa_native_options_parse(pa_native_options *o, pa_core *c, pa_modargs *ma) { o->srbchannel = true; if (pa_modargs_get_value_boolean(ma, "srbchannel", &o->srbchannel) < 0) { - pa_log("srbchannel= expects a boolean argument."); + AUDIO_ERR_LOG("srbchannel= expects a boolean argument."); return -1; } if (pa_modargs_get_value_boolean(ma, "auth-anonymous", &o->auth_anonymous) < 0) { - pa_log("auth-anonymous= expects a boolean argument."); + AUDIO_ERR_LOG("auth-anonymous= expects a boolean argument."); return -1; } enabled = true; if (pa_modargs_get_value_boolean(ma, "auth-group-enable", &enabled) < 0) { - pa_log("auth-group-enable= expects a boolean argument."); + AUDIO_ERR_LOG("auth-group-enable= expects a boolean argument."); return -1; } @@ -5446,14 +5445,14 @@ int pa_native_options_parse(pa_native_options *o, pa_core *c, pa_modargs *ma) { #ifndef HAVE_CREDS if (o->auth_group) - pa_log_warn("Authentication group configured, but not available on local system. Ignoring."); + AUDIO_ERR_LOG("Authentication group configured, but not available on local system. Ignoring."); #endif if ((acl = pa_modargs_get_value(ma, "auth-ip-acl", NULL))) { pa_ip_acl *ipa; if (!(ipa = pa_ip_acl_new(acl))) { - pa_log("Failed to parse IP ACL '%s'", acl); + AUDIO_ERR_LOG("Failed to parse IP ACL '%s'", acl); return -1; } @@ -5465,7 +5464,7 @@ int pa_native_options_parse(pa_native_options *o, pa_core *c, pa_modargs *ma) { enabled = true; if (pa_modargs_get_value_boolean(ma, "auth-cookie-enabled", &enabled) < 0) { - pa_log("auth-cookie-enabled= expects a boolean argument."); + AUDIO_ERR_LOG("auth-cookie-enabled= expects a boolean argument."); return -1; } diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c index f67cb907b..ab1fec9d7 100644 --- a/src/pulsecore/shm.c +++ b/src/pulsecore/shm.c @@ -121,7 +121,7 @@ static int privatemem_create(pa_shm *m, size_t size) { #ifdef MAP_ANONYMOUS if ((m->ptr = mmap(NULL, m->size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, (off_t) 0)) == MAP_FAILED) { - pa_log("mmap() failed: %s", pa_cstrerror(errno)); + AUDIO_ERR_LOG("mmap() failed: %{public}s", pa_cstrerror(errno)); return -1; } #elif defined(HAVE_POSIX_MEMALIGN) @@ -129,7 +129,7 @@ static int privatemem_create(pa_shm *m, size_t size) { int r; if ((r = posix_memalign(&m->ptr, pa_page_size(), size)) < 0) { - pa_log("posix_memalign() failed: %s", pa_cstrerror(r)); + AUDIO_ERR_LOG("posix_memalign() failed: %{public}s", pa_cstrerror(r)); return r; } } @@ -171,7 +171,7 @@ static int sharedmem_create(pa_shm *m, pa_mem_type_t type, size_t size, mode_t m } if (fd < 0) { - pa_log("%s open() failed: %s", pa_mem_type_to_string(type), pa_cstrerror(errno)); + AUDIO_ERR_LOG("%{public}s open() failed: %{public}s", pa_mem_type_to_string(type), pa_cstrerror(errno)); goto fail; } @@ -180,7 +180,7 @@ static int sharedmem_create(pa_shm *m, pa_mem_type_t type, size_t size, mode_t m m->do_unlink = do_unlink; if (ftruncate(fd, (off_t) m->size) < 0) { - pa_log("ftruncate() failed: %s", pa_cstrerror(errno)); + AUDIO_ERR_LOG("ftruncate() failed: %{public}s", pa_cstrerror(errno)); goto fail; } @@ -189,7 +189,7 @@ static int sharedmem_create(pa_shm *m, pa_mem_type_t type, size_t size, mode_t m #endif if ((m->ptr = mmap(NULL, PA_PAGE_ALIGN(m->size), PROT_READ|PROT_WRITE, MAP_SHARED|MAP_NORESERVE, fd, (off_t) 0)) == MAP_FAILED) { - pa_log("mmap() failed: %s", pa_cstrerror(errno)); + AUDIO_ERR_LOG("mmap() failed: %{public}s", pa_cstrerror(errno)); goto fail; } @@ -250,7 +250,7 @@ static void privatemem_free(pa_shm *m) { #ifdef MAP_ANONYMOUS if (munmap(m->ptr, m->size) < 0) - pa_log("munmap() failed: %s", pa_cstrerror(errno)); + AUDIO_ERR_LOG("munmap() failed: %{public}s", pa_cstrerror(errno)); #elif defined(HAVE_POSIX_MEMALIGN) free(m->ptr); #else @@ -276,7 +276,7 @@ void pa_shm_free(pa_shm *m) { #if defined(HAVE_SHM_OPEN) || defined(HAVE_MEMFD) if (munmap(m->ptr, PA_PAGE_ALIGN(m->size)) < 0) - pa_log("munmap() failed: %s", pa_cstrerror(errno)); + AUDIO_ERR_LOG("munmap() failed: %{public}s", pa_cstrerror(errno)); #ifdef HAVE_SHM_OPEN if (m->type == PA_MEM_TYPE_SHARED_POSIX && m->do_unlink) { @@ -284,7 +284,7 @@ void pa_shm_free(pa_shm *m) { segment_name(fn, sizeof(fn), m->id); if (shm_unlink(fn) < 0) - pa_log(" shm_unlink(%s) failed: %s", fn, pa_cstrerror(errno)); + AUDIO_ERR_LOG(" shm_unlink(%{public}s) failed: %{public}s", fn, pa_cstrerror(errno)); } #endif #ifdef HAVE_MEMFD @@ -294,7 +294,7 @@ void pa_shm_free(pa_shm *m) { #else /* We shouldn't be here without shm or memfd support */ - pa_log("remove pa_assert_not_reached call"); + AUDIO_ERR_LOG("remove pa_assert_not_reached call"); #endif finish: @@ -364,7 +364,7 @@ static int shm_attach(pa_shm *m, pa_mem_type_t type, unsigned id, int memfd_fd, segment_name(fn, sizeof(fn), id); if ((fd = shm_open(fn, writable ? O_RDWR : O_RDONLY, 0)) < 0) { if ((errno != EACCES && errno != ENOENT) || !for_cleanup) - pa_log("shm_open() failed: %s", pa_cstrerror(errno)); + AUDIO_ERR_LOG("shm_open() failed: %{public}s", pa_cstrerror(errno)); goto fail; } break; @@ -380,20 +380,20 @@ static int shm_attach(pa_shm *m, pa_mem_type_t type, unsigned id, int memfd_fd, } if (fstat(fd, &st) < 0) { - pa_log("fstat() failed: %s", pa_cstrerror(errno)); + AUDIO_ERR_LOG("fstat() failed: %{public}s", pa_cstrerror(errno)); goto fail; } if (st.st_size <= 0 || st.st_size > (off_t) MAX_SHM_SIZE + (off_t) shm_marker_size(type) || PA_ALIGN((size_t) st.st_size) != (size_t) st.st_size) { - pa_log("Invalid shared memory segment size"); + AUDIO_ERR_LOG("Invalid shared memory segment size"); goto fail; } prot = writable ? PROT_READ | PROT_WRITE : PROT_READ; if ((m->ptr = mmap(NULL, PA_PAGE_ALIGN(st.st_size), prot, MAP_SHARED, fd, (off_t) 0)) == MAP_FAILED) { - pa_log("mmap() failed: %s", pa_cstrerror(errno)); + AUDIO_ERR_LOG("mmap() failed: %{public}s", pa_cstrerror(errno)); goto fail; } @@ -436,7 +436,7 @@ int pa_shm_cleanup(void) { struct dirent *de; if (!(d = opendir(SHM_PATH))) { - pa_log_warn("Failed to read "SHM_PATH": %s", pa_cstrerror(errno)); + AUDIO_WARNING_LOG("Failed to read "SHM_PATH": %s", pa_cstrerror(errno)); return -1; } @@ -488,7 +488,7 @@ int pa_shm_cleanup(void) { segment_name(fn, sizeof(fn), id); if (shm_unlink(fn) < 0 && errno != EACCES && errno != ENOENT) - pa_log_warn("Failed to remove SHM segment %s: %s", fn, pa_cstrerror(errno)); + AUDIO_WARNING_LOG("Failed to remove SHM segment %{public}s: %{public}s", fn, pa_cstrerror(errno)); } closedir(d); -- Gitee From 88229ff6cb6e0a7003163d993c0ad5f7eeb6228b Mon Sep 17 00:00:00 2001 From: z00511616 Date: Sun, 4 Jun 2023 22:15:37 +0800 Subject: [PATCH 2/2] add hilog for context.c Signed-off-by: z00511616 Change-Id: I0136a0cf62570b7d190604a78a5a148ba80d0c68 --- ohosbuild/src/pulse/BUILD.gn | 3 +++ src/pulse/context.c | 6 ++++-- src/pulsecore/core.c | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ohosbuild/src/pulse/BUILD.gn b/ohosbuild/src/pulse/BUILD.gn index 008c9d02f..113d8b77f 100644 --- a/ohosbuild/src/pulse/BUILD.gn +++ b/ohosbuild/src/pulse/BUILD.gn @@ -28,6 +28,7 @@ config("pulse_config") { "$pulseaudio_build_path/include", "//third_party/glib/glib", "//third_party/glib", + "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", ] cflags = [ @@ -83,6 +84,8 @@ ohos_shared_library("pulse") { "$pulseaudio_build_path/src:pulsecommon", ] + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + subsystem_name = "multimedia" part_name = "audio_framework" } diff --git a/src/pulse/context.c b/src/pulse/context.c index 1d1bb9ee8..e0c8692a7 100644 --- a/src/pulse/context.c +++ b/src/pulse/context.c @@ -63,6 +63,8 @@ #include #include +#include "log/audio_log.h" + #include "internal.h" #include "context.h" @@ -561,8 +563,8 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t c->shm_type = PA_MEM_TYPE_SHARED_POSIX; } - pa_log_debug("Memfd possible: %s", pa_yes_no(c->memfd_on_local)); - pa_log_debug("Negotiated SHM type: %s", pa_mem_type_to_string(c->shm_type)); + AUDIO_INFO_LOG("Memfd possible: %{public}s", pa_yes_no(c->memfd_on_local)); + AUDIO_INFO_LOG("Negotiated SHM type: %{public}s", pa_mem_type_to_string(c->shm_type)); reply = pa_tagstruct_command(c, PA_COMMAND_SET_CLIENT_NAME, &tag); diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 95bce4a7f..dff81e432 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -105,7 +105,8 @@ pa_core* pa_core_new(pa_mainloop_api *m, bool shared, bool enable_memfd, size_t c->scache = pa_idxset_new(NULL, NULL); c->namereg = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); - c->shared = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); c->message_handlers = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); + c->shared = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); + c->message_handlers = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); c->default_source = NULL; c->default_sink = NULL; -- Gitee