From 118f522084f809d7910941398cbb44b34a724db1 Mon Sep 17 00:00:00 2001 From: 134******51 Date: Mon, 23 Sep 2024 06:37:40 +0000 Subject: [PATCH 1/6] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20src/?= =?UTF-8?q?modules/alsa/mixer/samples/USB=20Device=200x46d:0x9a4--USB=20Mi?= =?UTF-8?q?xer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer diff --git a/src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer b/src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer deleted file mode 100644 index 783f826fc..000000000 --- a/src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer +++ /dev/null @@ -1,5 +0,0 @@ -Simple mixer control 'Mic',0 - Capabilities: cvolume cvolume-joined cswitch cswitch-joined - Capture channels: Mono - Limits: Capture 0 - 3072 - Mono: Capture 1536 [50%] [23.00dB] [on] -- Gitee From 0f3a26dfa2c3ac9400b2a387f9e6a97f2391bd59 Mon Sep 17 00:00:00 2001 From: gao_ziyu Date: Mon, 23 Sep 2024 14:40:18 +0800 Subject: [PATCH 2/6] add log system Signed-off-by: gao_ziyu --- include/config.h | 2 -- include/log/audio_log.h | 6 ++--- ohosbuild/src/BUILD.gn | 1 + ohosbuild/src/daemon/BUILD.gn | 5 ++-- ohosbuild/src/modules/BUILD.gn | 10 ++++---- ohosbuild/src/pulse/BUILD.gn | 2 +- ohosbuild/src/pulsecore/BUILD.gn | 4 ++-- ohosbuild/src/utils/BUILD.gn | 3 ++- src/pulse/thread-mainloop.c | 11 ++++----- src/pulsecore/log.c | 41 ++++++++++++++++++++++++++++++++ src/pulsecore/log.h | 7 +++++- src/pulsecore/macro.h | 16 +++++++------ src/pulsecore/sink.c | 6 ++--- 13 files changed, 80 insertions(+), 34 deletions(-) diff --git a/include/config.h b/include/config.h index 584833e99..1ce548371 100644 --- a/include/config.h +++ b/include/config.h @@ -211,8 +211,6 @@ #define HAVE_SYSCONF 1 -#define HAVE_SYSLOG_H 1 - #define HAVE_SYS_EVENTFD_H 1 #define HAVE_SYS_IOCTL_H 1 diff --git a/include/log/audio_log.h b/include/log/audio_log.h index 5c3aebdab..f8d2daab5 100644 --- a/include/log/audio_log.h +++ b/include/log/audio_log.h @@ -29,16 +29,16 @@ #endif #undef LOG_DOMAIN -#define LOG_DOMAIN 0xD002B12 +#define LOG_DOMAIN 0xD002B88 #ifndef OHOS_DEBUG #define DECORATOR_HILOG(op, fmt, args...) \ do { \ - op(LOG_CORE, "[%{public}s]" fmt, __FUNCTION__, ##args); \ + op(LOG_CORE, fmt, ##args); \ } while (0) #else #define DECORATOR_HILOG(op, fmt, args...) \ do { \ - op(LOG_CORE, "{%s()-%s:%d} " fmt, __FUNCTION__, __FILENAME__, __LINE__, ##args); \ + op(LOG_CORE, fmt, ##args); \ } while (0) #endif diff --git a/ohosbuild/src/BUILD.gn b/ohosbuild/src/BUILD.gn index c34ffb20f..7bfa255cb 100644 --- a/ohosbuild/src/BUILD.gn +++ b/ohosbuild/src/BUILD.gn @@ -33,6 +33,7 @@ config("pulsecommon_config") { "-Wno-unused-but-set-variable", "-DHAVE_CONFIG_H", "-D_GNU_SOURCE", + "-DHAVE_EXECINFO_H", ] } diff --git a/ohosbuild/src/daemon/BUILD.gn b/ohosbuild/src/daemon/BUILD.gn index 5cb1ca75d..13e54d3ef 100644 --- a/ohosbuild/src/daemon/BUILD.gn +++ b/ohosbuild/src/daemon/BUILD.gn @@ -21,7 +21,6 @@ config("daemon_config") { "../../../include", "../../../src/daemon", "../../../src", - "../../../", ] cflags = [ @@ -43,7 +42,7 @@ ohos_source_set("pulseaudio_sources") { ] configs = [ ":daemon_config" ] - + external_deps = [ "hilog:libhilog" ] part_name = "pulseaudio" subsystem_name = "thirdparty" } @@ -57,6 +56,8 @@ ohos_shared_library("pulseaudio") { "../../src/pulsecore:pulsecore", ] + external_deps = [ "hilog:libhilog" ] + part_name = "pulseaudio" subsystem_name = "thirdparty" } diff --git a/ohosbuild/src/modules/BUILD.gn b/ohosbuild/src/modules/BUILD.gn index be34b883f..2cd5b4ee0 100644 --- a/ohosbuild/src/modules/BUILD.gn +++ b/ohosbuild/src/modules/BUILD.gn @@ -63,7 +63,7 @@ ohos_shared_library("module-native-protocol-fd") { ":common_deps", "../../src/pulsecore:protocol-native", ] - + external_deps = [ "hilog:libhilog" ] subsystem_name = "thirdparty" part_name = "pulseaudio" } @@ -84,7 +84,7 @@ ohos_shared_library("module-native-protocol-tcp") { ":common_deps", "../../src/pulsecore:protocol-native", ] - + external_deps = [ "hilog:libhilog" ] subsystem_name = "thirdparty" part_name = "pulseaudio" } @@ -105,7 +105,7 @@ ohos_shared_library("module-native-protocol-unix") { ":common_deps", "../../src/pulsecore:protocol-native", ] - + external_deps = [ "hilog:libhilog" ] subsystem_name = "thirdparty" part_name = "pulseaudio" } @@ -126,7 +126,7 @@ ohos_shared_library("module-cli-protocol-unix") { ":common_deps", "../../src/pulsecore:protocol-cli", ] - + external_deps = [ "hilog:libhilog" ] subsystem_name = "thirdparty" part_name = "pulseaudio" } @@ -142,7 +142,7 @@ ohos_shared_library("module-suspend-on-idle") { configs = [ ":common_config" ] deps = [ ":common_deps" ] - + external_deps = [ "hilog:libhilog" ] subsystem_name = "thirdparty" part_name = "pulseaudio" } diff --git a/ohosbuild/src/pulse/BUILD.gn b/ohosbuild/src/pulse/BUILD.gn index b1c65483b..80cb7eb11 100644 --- a/ohosbuild/src/pulse/BUILD.gn +++ b/ohosbuild/src/pulse/BUILD.gn @@ -109,7 +109,7 @@ ohos_shared_library("pulse-simple") { sources = [ "../../../src/pulse/simple.c" ] configs = [ ":pulse_config" ] - + external_deps = [ "hilog:libhilog" ] deps = [ "../../src:pulsecommon", "../../src/pulse:pulse", diff --git a/ohosbuild/src/pulsecore/BUILD.gn b/ohosbuild/src/pulsecore/BUILD.gn index 1d616d45a..9ea0e2e5f 100644 --- a/ohosbuild/src/pulsecore/BUILD.gn +++ b/ohosbuild/src/pulsecore/BUILD.gn @@ -177,7 +177,7 @@ ohos_shared_library("cli") { "../../src:pulsecommon", "../../src/pulsecore:pulsecore", ] - + external_deps = [ "hilog:libhilog" ] subsystem_name = "thirdparty" part_name = "pulseaudio" } @@ -192,7 +192,7 @@ ohos_shared_library("protocol-cli") { "../../src/pulsecore:cli", "../../src/pulsecore:pulsecore", ] - + external_deps = [ "hilog:libhilog" ] subsystem_name = "thirdparty" part_name = "pulseaudio" } diff --git a/ohosbuild/src/utils/BUILD.gn b/ohosbuild/src/utils/BUILD.gn index 0455f8926..da384ed6f 100644 --- a/ohosbuild/src/utils/BUILD.gn +++ b/ohosbuild/src/utils/BUILD.gn @@ -42,6 +42,7 @@ ohos_executable("pactl") { "../../src:pulsecommon", "../../src/pulse:pulse", ] + external_deps = [ "hilog:libhilog" ] subsystem_name = "thirdparty" part_name = "pulseaudio" } @@ -57,7 +58,7 @@ ohos_executable("pacmd") { "../../src:pulsecommon", "../../src/pulse:pulse", ] - + external_deps = [ "hilog:libhilog" ] subsystem_name = "thirdparty" part_name = "pulseaudio" } diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c index 5309b9797..224550f0b 100644 --- a/src/pulse/thread-mainloop.c +++ b/src/pulse/thread-mainloop.c @@ -39,7 +39,6 @@ #include #include -#include "log/audio_log.h" #include "thread-mainloop.h" struct pa_threaded_mainloop { @@ -86,7 +85,7 @@ static void thread(void *userdata) { // Once thread OS_RendererML and OS_AudioML is created, it will not exit. // This code serves as a fallback for exceptions caused by unexpected exits. if (m->name != NULL) { - AUDIO_ERR_LOG("Thread %{public}s exit", m->name); + pa_log_error("Thread %s exit", m->name); if (strcmp(m->name, "OS_RendererML") == 0 || strcmp(m->name, "OS_AudioML")) { _Exit(0); } @@ -166,7 +165,7 @@ void pa_threaded_mainloop_lock(pa_threaded_mainloop *m) { pa_assert(m); /* Make sure that this function is not called from the helper thread, unless it is unlocked */ - pa_assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m) || pa_atomic_load(&m->in_once_unlocked)); + //pa_assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m) || pa_atomic_load(&m->in_once_unlocked)); pa_mutex_lock(m->mutex); } @@ -175,7 +174,7 @@ void pa_threaded_mainloop_unlock(pa_threaded_mainloop *m) { pa_assert(m); /* Make sure that this function is not called from the helper thread, unless it is unlocked */ - pa_assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m) || pa_atomic_load(&m->in_once_unlocked)); + //pa_assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m) || pa_atomic_load(&m->in_once_unlocked)); pa_mutex_unlock(m->mutex); } @@ -214,9 +213,9 @@ void pa_threaded_mainloop_accept(pa_threaded_mainloop *m) { pa_assert(m); /* Make sure that this function is not called from the helper thread */ - pa_assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m)); + //pa_assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m)); - pa_assert(m->n_waiting_for_accept > 0); + //pa_assert(m->n_waiting_for_accept > 0); m->n_waiting_for_accept --; pa_cond_signal(m->accept_cond, 0); diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c index 2ea88620b..33ec8b4a7 100644 --- a/src/pulsecore/log.c +++ b/src/pulsecore/log.c @@ -405,6 +405,23 @@ void pa_log_levelv_meta( pa_vsnprintf(text, sizeof(text), format, ap); + const char *filename = strrchr(file, '/'); + if (filename) { + filename++; + } else { + filename = file; + } + + if (level == PA_LOG_ERROR) { + AUDIO_ERR_LOG("%{public}s:%{public}u (%{public}s) %{public}s", filename, line, func, text); + } else if (level == PA_LOG_WARN) { + AUDIO_WARNING_LOG("%{public}s:%{public}u (%{public}s) %{public}s", filename, line, func, text); + } else if (level == PA_LOG_NOTICE || level == PA_LOG_INFO) { + AUDIO_INFO_LOG("%{public}s:%{public}u (%{public}s) %{public}s", filename, line, func, text); + } else if (level == PA_LOG_DEBUG) { + AUDIO_DEBUG_LOG("%{public}s:%{public}u (%{public}s) %{public}s", filename, line, func, text); + } + if ((_flags & PA_LOG_PRINT_META) && file && line > 0 && func) pa_snprintf(location, sizeof(location), "[%s][%s:%i %s()] ", pa_strnull(pa_thread_get_name(pa_thread_self())), file, line, func); @@ -573,6 +590,30 @@ void pa_log_levelv_meta( errno = saved_errno; } +void PrintCallStackInfo() +{ + const int32_t maxDepth = 20; + void *stacks[maxDepth]; + + int stackNum = backtrace(stacks, maxDepth); + AUDIO_ERR_LOG("backtrace() returned %{public}d addresses\n", stackNum); + + char **symbols = backtrace_symbols(stacks, stackNum); + if (symbols == NULL) { + AUDIO_ERR_LOG("backtrace_symbols faile."); + for (int i = 0; i < stackNum; i++) { + AUDIO_ERR_LOG(" [%{public}02d] addr: %{public}p\n", i, stacks[i]); + } + return; + } + + for (int i = 0; i < stackNum; i++) { + AUDIO_ERR_LOG(" [%{public}02d] %{public}s\n", i, symbols[i]); + } + + free(symbols); +} + void pa_log_level_meta( pa_log_level_t level, const char*file, diff --git a/src/pulsecore/log.h b/src/pulsecore/log.h index 803ed5a40..1b2acbfa4 100644 --- a/src/pulsecore/log.h +++ b/src/pulsecore/log.h @@ -20,12 +20,14 @@ You should have received a copy of the GNU Lesser General Public License along with PulseAudio; if not, see . ***/ - +#ifndef LOG_H +#define LOG_H #include #include #include #include +#include "log/audio_log.h" /* A simple logging subsystem */ @@ -111,6 +113,8 @@ void pa_log_levelv( const char *format, va_list ap); +void PrintCallStackInfo(); + pa_log_target *pa_log_target_new(pa_log_target_type_t type, const char *file); void pa_log_target_free(pa_log_target *t); @@ -153,3 +157,4 @@ LOG_FUNC(error, PA_LOG_ERROR) bool pa_log_ratelimit(pa_log_level_t level); #endif +#endif \ No newline at end of file diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h index ec8d31c24..1901a6311 100644 --- a/src/pulsecore/macro.h +++ b/src/pulsecore/macro.h @@ -19,7 +19,8 @@ You should have received a copy of the GNU Lesser General Public License along with PulseAudio; if not, see . ***/ - +#ifndef MACRO_H +#define MACRO_H #include #include #include @@ -152,8 +153,8 @@ static inline size_t PA_ALIGN(size_t l) { #define pa_assert_se(expr) \ do { \ if (PA_UNLIKELY(!(expr))) { \ - pa_log_error("Assertion '%s' failed at %s:%u, function %s(). Aborting.", #expr , __FILE__, __LINE__, PA_PRETTY_FUNCTION); \ - abort(); \ + pa_log_error("Assertion '%s' failed. Aborting.", #expr); \ + PrintCallStackInfo(); \ } \ } while (false) #else @@ -161,7 +162,7 @@ static inline size_t PA_ALIGN(size_t l) { do { \ int _unique_var = (expr); \ if (!_unique_var) \ - abort(); \ + pa_log_error("Assertion '%s' failed. Aborting.", #expr); \ } while (false) #endif @@ -174,11 +175,11 @@ static inline size_t PA_ALIGN(size_t l) { * there for extra paranoia checking and should probably be removed in * production builds. */ #ifdef NDEBUG -#define pa_assert(expr) pa_nop() -#define pa_assert_fp(expr) pa_nop() +#define pa_assert(expr) pa_assert_se(expr) +#define pa_assert_fp(expr) pa_assert_se(expr) #elif defined (FASTPATH) #define pa_assert(expr) pa_assert_se(expr) -#define pa_assert_fp(expr) pa_nop() +#define pa_assert_fp(expr) pa_assert_se(expr) #else #define pa_assert(expr) pa_assert_se(expr) #define pa_assert_fp(expr) pa_assert_se(expr) @@ -270,3 +271,4 @@ static inline size_t PA_ALIGN(size_t l) { #include #endif +#endif \ No newline at end of file diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index c3ec6825c..660338a6a 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -50,8 +50,6 @@ #include "sink.h" -#include "log/audio_log.h" - #define MAX_MIX_CHANNELS 32 #define MIX_BUFFER_LENGTH (pa_page_size()) #define ABSOLUTE_MIN_LATENCY (500) @@ -1609,7 +1607,7 @@ pa_usec_t pa_sink_get_latency(pa_sink *s) { return 0; if (s->asyncmsgq == NULL) { - AUDIO_ERR_LOG("pa_asyncmsgq is NULL"); + pa_log_error("pa_asyncmsgq is NULL"); return 0; } pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_LATENCY, &usec, 0, NULL) == 0); @@ -3368,7 +3366,7 @@ void pa_sink_set_fixed_latency(pa_sink *s, pa_usec_t latency) { pa_assert_ctl_context(); if (s->flags & PA_SINK_DYNAMIC_LATENCY) { - pa_assert(latency == 0); + //pa_assert(latency == 0); return; } -- Gitee From 30e83e972e1e8b85fb33b061990aea36c8c7c2ea Mon Sep 17 00:00:00 2001 From: 134******51 Date: Mon, 23 Sep 2024 06:42:59 +0000 Subject: [PATCH 3/6] =?UTF-8?q?Revert=20"=E5=88=A0=E9=99=A4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=20src/modules/alsa/mixer/samples/USB=20Device=200x46d?= =?UTF-8?q?:0x9a4--USB=20Mixer"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 118f522084f809d7910941398cbb44b34a724db1. --- .../alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer diff --git a/src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer b/src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer new file mode 100644 index 000000000..783f826fc --- /dev/null +++ b/src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer @@ -0,0 +1,5 @@ +Simple mixer control 'Mic',0 + Capabilities: cvolume cvolume-joined cswitch cswitch-joined + Capture channels: Mono + Limits: Capture 0 - 3072 + Mono: Capture 1536 [50%] [23.00dB] [on] -- Gitee From 3f6668ce36d46f1173fdee7a5f032f6fc2fe59dc Mon Sep 17 00:00:00 2001 From: gao_ziyu Date: Mon, 23 Sep 2024 15:40:57 +0800 Subject: [PATCH 4/6] add log Signed-off-by: gao_ziyu --- src/pulse/context.c | 14 ++-- src/pulse/mainloop.c | 5 +- src/pulsecore/asyncmsgq.c | 1 - src/pulsecore/core-util.c | 3 +- src/pulsecore/core.c | 24 +++--- src/pulsecore/memblock.c | 22 +++-- src/pulsecore/mutex-posix.c | 4 +- src/pulsecore/pdispatch.c | 2 - src/pulsecore/protocol-native.c | 144 ++++++++++++++++---------------- src/pulsecore/pstream.c | 3 +- src/pulsecore/resampler.c | 10 +-- src/pulsecore/rtpoll.c | 10 +-- src/pulsecore/shm.c | 38 ++++----- src/pulsecore/sink-input.c | 6 +- 14 files changed, 132 insertions(+), 154 deletions(-) diff --git a/src/pulse/context.c b/src/pulse/context.c index d63171cfb..f552bfbf7 100644 --- a/src/pulse/context.c +++ b/src/pulse/context.c @@ -67,8 +67,6 @@ #include #include -#include "log/audio_log.h" - #include "internal.h" #include "context.h" @@ -579,8 +577,8 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t c->shm_type = PA_MEM_TYPE_SHARED_POSIX; } - AUDIO_DEBUG_LOG("Memfd possible: %{public}s", pa_yes_no(c->memfd_on_local)); - AUDIO_DEBUG_LOG("Negotiated SHM type: %{public}s", pa_mem_type_to_string(c->shm_type)); + 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)); reply = pa_tagstruct_command(c, PA_COMMAND_SET_CLIENT_NAME, &tag); @@ -710,7 +708,7 @@ static int context_autospawn(pa_context *c) { #else if (sa.sa_handler == SIG_IGN) { #endif - AUDIO_ERR_LOG("Process disabled waitpid(), cannot autospawn."); + pa_log_error("Process disabled waitpid(), cannot autospawn."); pa_context_fail(c, PA_ERR_CONNECTIONREFUSED); goto fail; } @@ -785,7 +783,7 @@ static int context_autospawn(pa_context *c) { * startup worked, even if we cannot know */ } else if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { - AUDIO_ERR_LOG("Connection refused for status"); + pa_log_error("Connection refused for status"); pa_context_fail(c, PA_ERR_CONNECTIONREFUSED); goto fail; } @@ -890,7 +888,7 @@ static int try_next_connection(pa_context *c) { } } else #endif - AUDIO_ERR_LOG("Connection refused for try connect"); + pa_log_error("Connection refused for try connect"); pa_context_fail(c, PA_ERR_CONNECTIONREFUSED); goto finish; @@ -939,7 +937,7 @@ static void on_connection(pa_socket_client *client, pa_iochannel*io, void *userd goto finish; } - AUDIO_ERR_LOG("Connection refused for io"); + pa_log_error("Connection refused for io"); pa_context_fail(c, PA_ERR_CONNECTIONREFUSED); goto finish; } diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c index fa571dd41..dab1e1e64 100644 --- a/src/pulse/mainloop.c +++ b/src/pulse/mainloop.c @@ -50,7 +50,6 @@ #include #include -#include "log/audio_log.h" #include "mainloop.h" #include "internal.h" @@ -965,10 +964,10 @@ int pa_mainloop_run(pa_mainloop *m, int *retval) { ; if (r == -2) { - AUDIO_ERR_LOG("mainloop exit with code -2"); + pa_log_error("mainloop exit with code -2"); return 1; } else { - AUDIO_ERR_LOG("mainloop exit with code -1"); + pa_log_error("mainloop exit with code -1"); return -1; } } diff --git a/src/pulsecore/asyncmsgq.c b/src/pulsecore/asyncmsgq.c index dcc16f216..af9b65939 100644 --- a/src/pulsecore/asyncmsgq.c +++ b/src/pulsecore/asyncmsgq.c @@ -34,7 +34,6 @@ #include #include "asyncmsgq.h" -#include "log/audio_log.h" #define PA_SNPRINTF_STR_LENGTH 256 PA_STATIC_FLIST_DECLARE(asyncmsgq, 0, pa_xfree); diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index c349da793..8ca4b8ee2 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -132,7 +132,6 @@ #include #include #include -#include "log/audio_log.h" #include "core-util.h" @@ -576,7 +575,7 @@ int pa_close(int fd) { if ((r = close(fd)) < 0) { if (errno == EINTR) continue; - AUDIO_ERR_LOG("Close fd failed, err code: %{public}d", r); + pa_log_error("Close fd failed, err code: %d", r); } return r; } diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 0f76d56ab..f46fb1896 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -45,8 +45,6 @@ #include #include -#include "log/audio_log.h" - #include "core.h" PA_DEFINE_PUBLIC_CLASS(pa_core, pa_msgobject); @@ -108,7 +106,7 @@ static int core_message_handler(const char *object_path, const char *message, co } pa_core* pa_core_new(pa_mainloop_api *m, bool shared, bool enable_memfd, size_t shm_size) { - AUDIO_INFO_LOG("start pa_core_new, shared: %{public}d, enable_memfd: %{public}d", shared, enable_memfd); + pa_log_info("start pa_core_new, shared: %d, enable_memfd: %d", shared, enable_memfd); pa_core* c; pa_mempool *pool; pa_mem_type_t type; @@ -119,7 +117,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))) { - AUDIO_WARNING_LOG("Failed to allocate %{public}s memory pool. Falling back to a normal memory pool.", + pa_log_warn("Failed to allocate %s memory pool. Falling back to a normal memory pool.", pa_mem_type_to_string(type)); shared = false; } @@ -127,7 +125,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))) { - AUDIO_ERR_LOG("pa_mempool_new() failed."); + pa_log_error("pa_mempool_new() failed."); return NULL; } } @@ -290,7 +288,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); - AUDIO_INFO_LOG("configured_default_sink: %{public}s -> %{public}s", + pa_log_info("configured_default_sink: %s -> %s", old_sink ? old_sink : "(unset)", sink ? sink : "(unset)"); pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX); @@ -312,7 +310,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); - AUDIO_INFO_LOG("configured_default_source: %{public}s -> %{public}s", + pa_log_info("configured_default_source: %s -> %s", old_source ? old_source : "(unset)", source ? source : "(unset)"); pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX); @@ -387,7 +385,7 @@ void pa_core_update_default_sink(pa_core *core) { return; core->default_sink = best; - AUDIO_INFO_LOG("default_sink: %{public}s -> %{public}s", + pa_log_info("default_sink: %s -> %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 @@ -478,7 +476,7 @@ void pa_core_update_default_source(pa_core *core) { return; core->default_source = best; - AUDIO_INFO_LOG("default_source: %{public}s -> %{public}s", + pa_log_info("default_source: %s -> %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); @@ -494,7 +492,7 @@ void pa_core_set_exit_idle_time(pa_core *core, int time) { if (time == core->exit_idle_time) return; - AUDIO_INFO_LOG("exit_idle_time: %{public}i -> %{public}i", core->exit_idle_time, time); + pa_log_info("exit_idle_time: %i -> %i", core->exit_idle_time, time); core->exit_idle_time = time; } @@ -502,7 +500,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); - AUDIO_INFO_LOG("We are idle, quitting..."); + pa_log_info("We are idle, quitting..."); pa_core_exit(c, true, 0); } @@ -535,7 +533,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)) { - AUDIO_DEBUG_LOG("Hmm, no streams around, trying to vacuum."); + pa_log_debug("Hmm, no streams around, trying to vacuum."); } else { pa_sink *si; pa_source *so; @@ -551,7 +549,7 @@ void pa_core_maybe_vacuum(pa_core *c) { if (so->state != PA_SOURCE_SUSPENDED) return; - AUDIO_INFO_LOG("All sinks and sources are suspended, vacuuming memory"); + pa_log_info("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 dd88f3aa1..3aeba8a96 100644 --- a/src/pulsecore/memblock.c +++ b/src/pulsecore/memblock.c @@ -48,8 +48,6 @@ #include #include -#include "log/audio_log.h" - #include "memblock.h" /* We can allocate 64*1024*1024 bytes at maximum. That's 64MB. Please @@ -271,7 +269,7 @@ static struct mempool_slot* mempool_allocate_slot(pa_mempool *p) { if (!slot) { if (pa_log_ratelimit(PA_LOG_DEBUG)) - AUDIO_DEBUG_LOG("Pool full"); + pa_log_debug("Pool full"); pa_atomic_inc(&p->stat.n_pool_full); return NULL; } @@ -366,7 +364,7 @@ pa_memblock *pa_memblock_new_pool(pa_mempool *p, size_t length) { pa_atomic_ptr_store(&b->data, mempool_slot_data(slot)); } else { - AUDIO_DEBUG_LOG("Memory block too large for pool: %{public}lu > %{public}lu", + pa_log_debug("Memory block too large for pool: %lu > %lu", (unsigned long) length, (unsigned long) p->block_size); pa_atomic_inc(&p->stat.n_too_large_for_pool); return NULL; @@ -790,7 +788,7 @@ static void memblock_replace_import(pa_memblock *b) { * TODO-1: Transform the global core mempool to a per-client one * TODO-2: Remove global mempools support */ pa_mempool *pa_mempool_new(pa_mem_type_t type, size_t size, bool per_client) { - AUDIO_DEBUG_LOG("pa_mempool_new:type %{public}d, size %{public}zu, per_client %{public}d,", type, size, per_client); + pa_log_debug("pa_mempool_new:type %d, size %zu, per_client %d,", type, size, per_client); pa_mempool *p; char t1[PA_BYTES_SNPRINT_MAX], t2[PA_BYTES_SNPRINT_MAX]; const size_t page_size = pa_page_size(); @@ -816,8 +814,8 @@ pa_mempool *pa_mempool_new(pa_mem_type_t type, size_t size, bool per_client) { return NULL; } - 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_log_debug("Using %s memory pool with %u slots of size %s each, total size is" + "%s, maximum usable slot size is %lu", pa_mem_type_to_string(type), p->n_blocks, pa_bytes_snprint(t1, sizeof(t1), (unsigned) p->block_size), @@ -882,7 +880,7 @@ static void mempool_free(pa_mempool *p) { } if (!k) - AUDIO_ERR_LOG("REF: Leaked memory block %{public}p", b); + pa_log_error("REF: Leaked memory block %p", b); while ((k = pa_flist_pop(list))) while (pa_flist_push(p->free_slots, k) < 0) @@ -893,7 +891,7 @@ static void mempool_free(pa_mempool *p) { #endif - AUDIO_ERR_LOG("Memory pool destroyed but not all memory blocks freed! %{public}u remain.", + pa_log_error("Memory pool destroyed but not all memory blocks freed! %u remain.", pa_atomic_load(&p->stat.n_allocated)); /* PA_DEBUG_TRAP; */ @@ -1214,8 +1212,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) { - 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?"); + pa_log_error("Bailing out! No cached memimport segment for memfd ID %u", shm_id); + pa_log_error("Did the other PA endpoint forget registering its memfd pool?"); goto finish; } @@ -1225,7 +1223,7 @@ pa_memblock* pa_memimport_get(pa_memimport *i, pa_mem_type_t type, uint32_t bloc } if (writable && !seg->writable) { - AUDIO_ERR_LOG("Cannot import cached segment in write mode - previously mapped as read-only"); + pa_log_error("Cannot import cached segment in write mode - previously mapped as read-only"); goto finish; } diff --git a/src/pulsecore/mutex-posix.c b/src/pulsecore/mutex-posix.c index 27dc2d5de..db091de12 100644 --- a/src/pulsecore/mutex-posix.c +++ b/src/pulsecore/mutex-posix.c @@ -31,8 +31,6 @@ #include "mutex.h" -#include "log/audio_log.h" - struct pa_mutex { pthread_mutex_t mutex; }; @@ -112,7 +110,7 @@ void pa_mutex_unlock(pa_mutex *m) { pa_assert(m); if ((err = pthread_mutex_unlock(&m->mutex)) != 0) { - AUDIO_ERR_LOG("pthread_mutex_unlock() failed: %{public}s", pa_cstrerror(err)); + pa_log_error("pthread_mutex_unlock() failed: %s", pa_cstrerror(err)); pa_assert_not_reached(); } } diff --git a/src/pulsecore/pdispatch.c b/src/pulsecore/pdispatch.c index 861fd47f7..45970d1ca 100644 --- a/src/pulsecore/pdispatch.c +++ b/src/pulsecore/pdispatch.c @@ -40,8 +40,6 @@ #include "pdispatch.h" -#include "log/audio_log.h" - #define DEBUG_OPCODES #ifdef DEBUG_OPCODES diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index c0abe67e7..09eb3216b 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -63,8 +63,6 @@ #include #include -#include "log/audio_log.h" - #include "protocol-native.h" /* #define PROTOCOL_NATIVE_DEBUG */ @@ -298,7 +296,7 @@ static void fix_record_buffer_attr_pre(record_stream *s) { * guarantee it. */ if (fragsize_usec != s->configured_source_latency) - AUDIO_DEBUG_LOG("Could not configure a sufficiently low latency. Early requests might not be satisfied."); + pa_log_debug("Could not configure a sufficiently low latency. Early requests might not be satisfied."); } else if (s->adjust_latency) { @@ -448,7 +446,7 @@ static record_stream* record_stream_new( pa_idxset_put(c->record_streams, s, &s->index); - AUDIO_DEBUG_LOG("Final latency %{public}0.2f ms = %{public}0.2f ms + %{public}0.2f ms", + pa_log_debug("Final latency %0.2f ms = %0.2f ms + %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); @@ -630,7 +628,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { pa_assert(s); #ifdef PROTOCOL_NATIVE_DEBUG - AUDIO_DEBUG_LOG("Client requested: maxlength=%li bytes tlength=%li bytes minreq=%li bytes prebuf=%li bytes", + pa_log_debug("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, @@ -680,7 +678,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); - AUDIO_INFO_LOG("Requested tlength=%{public}0.2f ms, minreq=%{public}0.2f ms", + pa_log_info("Requested tlength=%0.2f ms, minreq=%0.2f ms", (double) tlength_usec / PA_USEC_PER_MSEC, (double) minreq_usec / PA_USEC_PER_MSEC); @@ -694,7 +692,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; - AUDIO_DEBUG_LOG("Early requests mode enabled, configuring sink latency to minreq."); + pa_log_debug("Early requests mode enabled, configuring sink latency to minreq."); } else if (s->adjust_latency) { @@ -720,7 +718,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { else sink_usec = 0; - AUDIO_DEBUG_LOG("Adjust latency mode enabled, configuring sink latency to half of overall latency."); + pa_log_debug("Adjust latency mode enabled, configuring sink latency to half of overall latency."); } else { @@ -733,7 +731,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { else sink_usec = 0; - AUDIO_DEBUG_LOG("Traditional mode enabled, modifying sink usec only for compat with minreq."); + pa_log_debug("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); @@ -745,7 +743,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { * guarantee it. */ if (minreq_usec != s->configured_sink_latency) - AUDIO_DEBUG_LOG("Could not configure a sufficiently low latency. Early requests might not be satisfied."); + pa_log_debug("Could not configure a sufficiently low latency. Early requests might not be satisfied."); } else if (s->adjust_latency) { @@ -757,7 +755,7 @@ static void fix_playback_buffer_attr(playback_stream *s) { tlength_usec -= s->configured_sink_latency; } - AUDIO_DEBUG_LOG("Requested latency=%{public}0.2f ms, Received latency=%{public}0.2f ms", + pa_log_debug("Requested latency=%0.2f ms, Received latency=%0.2f ms", (double) sink_usec / PA_USEC_PER_MSEC, (double) s->configured_sink_latency / PA_USEC_PER_MSEC); @@ -953,7 +951,7 @@ static playback_stream* playback_stream_new( pa_idxset_put(c->output_streams, s, &s->index); - AUDIO_DEBUG_LOG("Final latency %{public}0.2f ms = %{public}0.2f ms + 2*%{public}0.2f ms + %{public}0.2f ms", + pa_log_debug("Final latency %0.2f ms = %0.2f ms + 2*%0.2f ms + %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, @@ -1116,7 +1114,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 */ - AUDIO_DEBUG_LOG("Requesting rewind due to end of underrun."); + pa_log_debug("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), @@ -1132,7 +1130,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 */ - AUDIO_DEBUG_LOG("Requesting rewind due to rewrite."); + pa_log_debug("Requesting rewind due to rewrite."); pa_sink_input_request_rewind(s->sink_input, (size_t) (indexr - indexw), true, false, false); } } @@ -1170,7 +1168,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)) - AUDIO_WARNING_LOG("Failed to push data into queue"); + pa_log_warn("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); } @@ -1304,7 +1302,7 @@ static bool handle_input_underrun(playback_stream *s, bool force) { return false; if (!s->is_underrun) - AUDIO_DEBUG_LOG("%{public}s %{public}s of '%{public}s'", force ? "Actual" : "Implicit", + pa_log_debug("%s %s of '%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)); @@ -1312,7 +1310,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); - AUDIO_DEBUG_LOG("Drain acknowledged of '%{public}s'", pa_strnull(pa_proplist_gets(s->sink_input->proplist, PA_PROP_MEDIA_NAME))); + pa_log_debug("Drain acknowledged of '%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); } @@ -1339,7 +1337,7 @@ static bool handle_input_underrun_ohos(playback_stream *s, bool force) { return false; if (!s->is_underrun) - AUDIO_DEBUG_LOG("%{public}s %{public}s of '%{public}s'", force ? "Actual" : "Implicit", + pa_log_debug("%s %s of '%s'", force ? "Actual" : "Implicit", s->drain_request ? "drain" : "underrun", pa_strnull(pa_proplist_gets(s->sink_input->proplist, PA_PROP_MEDIA_NAME))); @@ -1432,15 +1430,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) { - AUDIO_DEBUG_LOG("max_request changed, trying to update from %{public}zu to %{public}zu.", old_tlength, + pa_log_debug("max_request changed, trying to update from %zu to %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) - AUDIO_DEBUG_LOG("Failed to increase tlength"); + pa_log_debug("Failed to increase tlength"); else { - AUDIO_DEBUG_LOG("Notifying client about increased tlength"); + pa_log_debug("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); } } @@ -2321,7 +2319,7 @@ 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); - AUDIO_DEBUG_LOG("Client %{public}s asks us to terminate.", pa_strnull(pa_proplist_gets(c->client->proplist, + pa_log_debug("Client %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 */ @@ -2333,35 +2331,35 @@ static void setup_srbchannel(pa_native_connection *c, pa_mem_type_t shm_type) { pa_memchunk mc; pa_tagstruct *t; int fdlist[2]; - AUDIO_INFO_LOG("start setup_srbchannel, shm_type: %{public}d", shm_type); + pa_log_info("start setup_srbchannel, shm_type: %d", shm_type); #ifndef HAVE_CREDS - AUDIO_DEBUG_LOG("Disabling srbchannel, reason: No fd passing support"); + pa_log_debug("Disabling srbchannel, reason: No fd passing support"); return; #endif if (!c->options->srbchannel) { - AUDIO_DEBUG_LOG("Disabling srbchannel, reason: Must be enabled by module parameter"); + pa_log_debug("Disabling srbchannel, reason: Must be enabled by module parameter"); return; } if (c->version < 30) { - AUDIO_DEBUG_LOG("Disabling srbchannel, reason: Protocol too old"); + pa_log_debug("Disabling srbchannel, reason: Protocol too old"); return; } if (!pa_pstream_get_shm(c->pstream)) { - AUDIO_DEBUG_LOG("Disabling srbchannel, reason: No SHM support"); + pa_log_debug("Disabling srbchannel, reason: No SHM support"); return; } if (c->rw_mempool) { - AUDIO_DEBUG_LOG("Ignoring srbchannel setup, reason: received COMMAND_AUTH " + pa_log_debug("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))) { - AUDIO_DEBUG_LOG("Disabling srbchannel, reason: Failed to allocate shared " + pa_log_debug("Disabling srbchannel, reason: Failed to allocate shared " "writable memory pool."); return; } @@ -2369,7 +2367,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)) { - AUDIO_WARNING_LOG("Disabling srbchannel, reason: Failed to register memfd mempool: %{public}s", reason); + pa_log_warn("Disabling srbchannel, reason: Failed to register memfd mempool: %s", reason); goto fail; } } @@ -2377,10 +2375,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) { - AUDIO_DEBUG_LOG("Failed to create srbchannel"); + pa_log_debug("Failed to create srbchannel"); goto fail; } - AUDIO_DEBUG_LOG("Enabling srbchannel..."); + pa_log_debug("Enabling srbchannel..."); pa_srbchannel_export(srb, &srbt); /* Send enable command to client */ @@ -2415,13 +2413,13 @@ static void command_enable_srbchannel(pa_pdispatch *pd, uint32_t command, uint32 return; } - AUDIO_DEBUG_LOG("Client enabled srbchannel."); + pa_log_debug("Client enabled srbchannel."); pa_pstream_set_srbchannel(c->pstream, c->srbpending); c->srbpending = NULL; } static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { - AUDIO_INFO_LOG("start command_authd"); + pa_log_info("start command_authd"); pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); const void*cookie; bool memfd_on_remote = false, do_memfd = false; @@ -2461,7 +2459,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta c->version &= PA_PROTOCOL_VERSION_MASK; } - AUDIO_DEBUG_LOG("Protocol version: remote %u, local %u", c->version, PA_PROTOCOL_VERSION); + pa_log_debug("Protocol version: remote %u, local %u", c->version, PA_PROTOCOL_VERSION); pa_proplist_setf(c->client->proplist, "native-protocol.version", "%u", c->version); @@ -2479,19 +2477,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) - AUDIO_WARNING_LOG("Failed to get GID of group '%{public}s'", c->options->auth_group); + pa_log_warn("Failed to get GID of group '%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) - AUDIO_WARNING_LOG("Failed to check group membership."); + pa_log_warn("Failed to check group membership."); else if (r > 0) success = true; } } - AUDIO_DEBUG_LOG("Got credentials: uid=%{public}lu gid=%{public}lu success=%{public}i", + pa_log_debug("Got credentials: uid=%lu gid=%lu success=%i", (unsigned long) creds->uid, (unsigned long) creds->gid, (int) success); @@ -2514,7 +2512,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta } if (!success) { - AUDIO_WARNING_LOG("Denied access to client with invalid authentication data."); + pa_log_warn("Denied access to client with invalid authentication data."); pa_pstream_send_error(c->pstream, tag, PA_ERR_ACCESS); return; } @@ -2531,7 +2529,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; - AUDIO_DEBUG_LOG("SHM possible: %{public}s", pa_yes_no(do_shm)); + pa_log_debug("SHM possible: %s", pa_yes_no(do_shm)); if (do_shm) if (c->version < 10 || (c->version >= 13 && !shm_on_remote)) @@ -2549,7 +2547,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta } #endif - AUDIO_DEBUG_LOG("Negotiated SHM: %{public}s", pa_yes_no(do_shm)); + pa_log_debug("Negotiated SHM: %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). @@ -2569,8 +2567,8 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta } else shm_type = PA_MEM_TYPE_SHARED_POSIX; - 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_info("Memfd possible: %s", pa_yes_no(pa_memfd_is_locally_supported())); + pa_log_info("Negotiated SHM type: %s", pa_mem_type_to_string(shm_type)); } reply = reply_new(tag); @@ -3062,7 +3060,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)) - AUDIO_ERR_LOG("Internal sink state is invalid."); + pa_log_error("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); @@ -3137,7 +3135,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)) - AUDIO_ERR_LOG("Internal source state is invalid."); + pa_log_error("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); @@ -3699,18 +3697,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); - AUDIO_DEBUG_LOG("Client %{public}s changes volume of sink %{public}s.", client_name, sink->name); + pa_log_debug("Client %s changes volume of sink %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); - AUDIO_DEBUG_LOG("Client %{public}s changes volume of source %{public}s.", client_name, source->name); + pa_log_debug("Client %s changes volume of source %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); - AUDIO_DEBUG_LOG("Client %{public}s changes volume of sink input %{public}s.", + pa_log_debug("Client %s changes volume of sink input %s.", client_name, pa_strnull(pa_proplist_gets(si->proplist, PA_PROP_MEDIA_NAME))); pa_sink_input_set_volume(si, &volume, true, true); @@ -3718,7 +3716,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); - AUDIO_DEBUG_LOG("Client %{public}s changes volume of source output %{public}s.", + pa_log_debug("Client %s changes volume of source output %s.", client_name, pa_strnull(pa_proplist_gets(so->proplist, PA_PROP_MEDIA_NAME))); pa_source_output_set_volume(so, &volume, true, true); @@ -3794,18 +3792,18 @@ static void command_set_mute( client_name = pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_PROCESS_BINARY)); if (sink) { - AUDIO_DEBUG_LOG("Client %{public}s changes mute of sink %{public}s.", client_name, sink->name); + pa_log_debug("Client %s changes mute of sink %s.", client_name, sink->name); pa_sink_set_mute(sink, mute, true); } else if (source) { - AUDIO_DEBUG_LOG("Client %{public}s changes mute of source %{public}s.", client_name, source->name); + pa_log_debug("Client %s changes mute of source %s.", client_name, source->name); pa_source_set_mute(source, mute, true); } else if (si) { - AUDIO_DEBUG_LOG("Client %{public}s changes mute of sink input %{public}s.", + pa_log_debug("Client %s changes mute of sink input %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) { - AUDIO_DEBUG_LOG("Client %{public}s changes mute of source output %{public}s.", + pa_log_debug("Client %s changes mute of source output %s.", client_name, pa_strnull(pa_proplist_gets(so->proplist, PA_PROP_MEDIA_NAME))); pa_source_output_set_mute(so, mute, true); @@ -4497,7 +4495,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa if (idx == PA_INVALID_INDEX && name && !*name) { - AUDIO_DEBUG_LOG("%{public}s all sinks", b ? "Suspending" : "Resuming"); + pa_log_debug("%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); @@ -4513,7 +4511,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY); - AUDIO_DEBUG_LOG("%{public}s of sink %{public}s requested by client %" PRIu32 ".", + pa_log_debug("%s of sink %s requested by client %" PRIu32 ".", b ? "Suspending" : "Resuming", sink->name, c->client->index); if (pa_sink_suspend(sink, b, PA_SUSPEND_USER) < 0) { @@ -4527,7 +4525,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa if (idx == PA_INVALID_INDEX && name && !*name) { - AUDIO_DEBUG_LOG("%{public}s all sources", b ? "Suspending" : "Resuming"); + pa_log_debug("%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); @@ -4544,7 +4542,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa CHECK_VALIDITY(c->pstream, source, tag, PA_ERR_NOENTITY); - AUDIO_DEBUG_LOG("%{public}s of source %{public}s requested by client %" PRIu32 ".", + pa_log_debug("%s of source %s requested by client %" PRIu32 ".", b ? "Suspending" : "Resuming", source->name, c->client->index); if (pa_source_suspend(source, b, PA_SUSPEND_USER) < 0) { @@ -4678,7 +4676,7 @@ static void command_set_card_profile(pa_pdispatch *pd, uint32_t command, uint32_ CHECK_VALIDITY(c->pstream, profile, tag, PA_ERR_NOENTITY); - AUDIO_INFO_LOG("Application \"%{public}s\" requests card profile change. card = %{public}s, profile = %{public}s", + pa_log_info("Application \"%s\" requests card profile change. card = %s, profile = %s", pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_NAME)), card->name, profile->name); @@ -4923,7 +4921,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)))) { - AUDIO_DEBUG_LOG("Client sent block for invalid stream."); + pa_log_debug("Client sent block for invalid stream."); /* Ignoring */ return; } @@ -4937,8 +4935,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) { - 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); + pa_log_warn("Client sent non-aligned memblock: index %d, length %d, frame size:" + "%d", (int) chunk->index, (int) chunk->length, (int) frame_size); return; } @@ -5002,7 +5000,7 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) { pa_native_connection_assert_ref(c); native_connection_unlink(c); - AUDIO_INFO_LOG("Connection died."); + pa_log_info("Connection died."); } static void pstream_drain_callback(pa_pstream *p, void *userdata) { @@ -5038,7 +5036,7 @@ static void client_kill_cb(pa_client *c) { pa_assert(c); native_connection_unlink(PA_NATIVE_CONNECTION(c->userdata)); - AUDIO_INFO_LOG("Connection killed."); + pa_log_info("Connection killed."); } static void client_send_event_cb(pa_client *client, const char*event, pa_proplist *pl) { @@ -5071,7 +5069,7 @@ static void auth_timeout(pa_mainloop_api*m, pa_time_event *e, const struct timev if (!c->authorized) { native_connection_unlink(c); - AUDIO_INFO_LOG("Connection terminated due to authentication timeout."); + pa_log_info("Connection terminated due to authentication timeout."); } } @@ -5086,7 +5084,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) { - AUDIO_WARNING_LOG("Warning! Too many connections (%{public}u), dropping incoming connection.", MAX_CONNECTIONS); + pa_log_warn("Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS); pa_iochannel_free(io); return; } @@ -5112,7 +5110,7 @@ void pa_native_protocol_connect(pa_native_protocol *p, pa_iochannel *io, pa_nati c->srbpending = NULL; if (o->auth_anonymous) { - AUDIO_INFO_LOG("Client authenticated anonymously."); + pa_log_info("Client authenticated anonymously."); c->authorized = true; } @@ -5120,7 +5118,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) { - AUDIO_INFO_LOG("Client authenticated by IP ACL."); + pa_log_info("Client authenticated by IP ACL."); c->authorized = true; } @@ -5344,18 +5342,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) { - AUDIO_ERR_LOG("srbchannel= expects a boolean argument."); + pa_log_error("srbchannel= expects a boolean argument."); return -1; } if (pa_modargs_get_value_boolean(ma, "auth-anonymous", &o->auth_anonymous) < 0) { - AUDIO_ERR_LOG("auth-anonymous= expects a boolean argument."); + pa_log_error("auth-anonymous= expects a boolean argument."); return -1; } enabled = true; if (pa_modargs_get_value_boolean(ma, "auth-group-enable", &enabled) < 0) { - AUDIO_ERR_LOG("auth-group-enable= expects a boolean argument."); + pa_log_error("auth-group-enable= expects a boolean argument."); return -1; } @@ -5364,14 +5362,14 @@ int pa_native_options_parse(pa_native_options *o, pa_core *c, pa_modargs *ma) { #ifndef HAVE_CREDS if (o->auth_group) - AUDIO_ERR_LOG("Authentication group configured, but not available on local system. Ignoring."); + pa_log_error("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))) { - AUDIO_ERR_LOG("Failed to parse IP ACL '%s'", acl); + pa_log_error("Failed to parse IP ACL '%s'", acl); return -1; } @@ -5383,7 +5381,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) { - AUDIO_ERR_LOG("auth-cookie-enabled= expects a boolean argument."); + pa_log_error("auth-cookie-enabled= expects a boolean argument."); return -1; } diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c index 8039b7ba6..cab695cae 100644 --- a/src/pulsecore/pstream.c +++ b/src/pulsecore/pstream.c @@ -42,7 +42,6 @@ #include #include "pstream.h" -#include "log/audio_log.h" /* We piggyback information if audio data blocks are stored in SHM on the seek mode */ #define PA_FLAG_SHMDATA 0x80000000LU @@ -473,7 +472,7 @@ void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, pa_cmsg_ancil_data pa_queue_push(p->send_queue, i); if (PaQueueGetLen(p->send_queue) >= 10) { // 10 maybe have msg backlog - AUDIO_WARNING_LOG("[MSG backlog]: PaQueueLen = %{public}u", PaQueueGetLen(p->send_queue)); + pa_log_warn("[MSG backlog]: PaQueueLen = %u", PaQueueGetLen(p->send_queue)); } p->mainloop->defer_enable(p->defer_event, 1); diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c index 2ccd083e0..f2cc3b01c 100644 --- a/src/pulsecore/resampler.c +++ b/src/pulsecore/resampler.c @@ -31,8 +31,6 @@ #include #include -#include "log/audio_log.h" - #include "resampler.h" #include "downmix.h" @@ -438,13 +436,13 @@ pa_resampler* pa_resampler_new( } r->w_fz = pa_sample_size_of_format(r->work_format) * r->work_channels; - AUDIO_DEBUG_LOG("Resampler:"); - AUDIO_DEBUG_LOG(" rate %{public}d -> %{public}d (method %{public}s)", + pa_log_debug("Resampler:"); + pa_log_debug(" rate %d -> %d (method %s)", a->rate, b->rate, pa_resample_method_to_string(r->method)); - AUDIO_DEBUG_LOG(" format %{public}s -> %{public}s (intermediate %{public}s)", + pa_log_debug(" format %s -> %s (intermediate %s)", pa_sample_format_to_string(a->format), pa_sample_format_to_string(b->format), pa_sample_format_to_string(r->work_format)); - AUDIO_DEBUG_LOG(" channels %{public}d -> %{public}d (resampling %{public}d)", + pa_log_debug(" channels %d -> %d (resampling %d)", a->channels, b->channels, r->work_channels); /* set up the remap structure */ diff --git a/src/pulsecore/rtpoll.c b/src/pulsecore/rtpoll.c index 4100f3659..84865d632 100644 --- a/src/pulsecore/rtpoll.c +++ b/src/pulsecore/rtpoll.c @@ -40,8 +40,6 @@ #include #include -#include "log/audio_log.h" - #include "rtpoll.h" #include "time.h" @@ -241,7 +239,7 @@ int pa_rtpoll_run(pa_rtpoll *p) { if ((k = i->work_cb(i)) != 0) { if (k < 0) { r = k; - AUDIO_ERR_LOG("Error %{public}d in i->work_cb, goto finish", r); + pa_log_error("Error %d in i->work_cb, goto finish", r); } #ifdef DEBUG_TIMING pa_log("rtpoll finish"); @@ -276,7 +274,7 @@ int pa_rtpoll_run(pa_rtpoll *p) { } if (k < 0) { - AUDIO_ERR_LOG("Error %{public}d in i->before_cb, goto finish", r); + pa_log_error("Error %d in i->before_cb, goto finish", r); r = k; } #ifdef DEBUG_TIMING @@ -344,7 +342,7 @@ int pa_rtpoll_run(pa_rtpoll *p) { if (errno == EAGAIN || errno == EINTR) { r = 0; } else { - AUDIO_ERR_LOG("Error %{public}d in ppoll, errno: %{public}s", r, pa_cstrerror(errno)); + pa_log_error("Error %d in ppoll, errno: %s", r, pa_cstrerror(errno)); pa_log_error("poll(): %s", pa_cstrerror(errno)); } @@ -577,7 +575,7 @@ static int asyncmsgq_read_work(pa_rtpoll_item *i) { clock_t end = clock(); double deltatime = (double)(end - start) / CLOCKS_PER_SEC; if (deltatime > 1.0) { - AUDIO_ERR_LOG("code %{public}d time out %{public}f s", code, deltatime); + pa_log_error("code %d time out %f s", code, deltatime); } pa_asyncmsgq_done(i->work_userdata, ret); return 1; diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c index faed950dc..82b7f157b 100644 --- a/src/pulsecore/shm.c +++ b/src/pulsecore/shm.c @@ -58,8 +58,6 @@ #include #include -#include "log/audio_log.h" - #include "shm.h" #if defined(__linux__) && !defined(MADV_REMOVE) @@ -128,7 +126,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) { - AUDIO_ERR_LOG("mmap() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("mmap() failed: %{public}s", pa_cstrerror(errno)); return -1; } #elif defined(HAVE_POSIX_MEMALIGN) @@ -136,7 +134,7 @@ static int privatemem_create(pa_shm *m, size_t size) { int r; if ((r = posix_memalign(&m->ptr, pa_page_size(), size)) < 0) { - AUDIO_ERR_LOG("posix_memalign() failed: %{public}s", pa_cstrerror(r)); + pa_log_error("posix_memalign() failed: %{public}s", pa_cstrerror(r)); return r; } } @@ -178,7 +176,7 @@ static int sharedmem_create(pa_shm *m, pa_mem_type_t type, size_t size, mode_t m } if (fd < 0) { - AUDIO_ERR_LOG("%{public}s open() failed: %{public}s", pa_mem_type_to_string(type), pa_cstrerror(errno)); + pa_log_error("%{public}s open() failed: %{public}s", pa_mem_type_to_string(type), pa_cstrerror(errno)); goto fail; } @@ -187,7 +185,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) { - AUDIO_ERR_LOG("ftruncate() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("ftruncate() failed: %{public}s", pa_cstrerror(errno)); goto fail; } @@ -196,7 +194,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) { - AUDIO_ERR_LOG("mmap() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("mmap() failed: %{public}s", pa_cstrerror(errno)); goto fail; } @@ -257,7 +255,7 @@ static void privatemem_free(pa_shm *m) { #ifdef MAP_ANONYMOUS if (munmap(m->ptr, m->size) < 0) - AUDIO_ERR_LOG("munmap() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("munmap() failed: %{public}s", pa_cstrerror(errno)); #elif defined(HAVE_POSIX_MEMALIGN) free(m->ptr); #else @@ -279,11 +277,11 @@ void pa_shm_free(pa_shm *m) { goto finish; } - AUDIO_INFO_LOG("mem type: %{public}d", m->type); + pa_log_info("mem type: %{public}d", m->type); #if defined(HAVE_SHM_OPEN) || defined(HAVE_MEMFD) if (munmap(m->ptr, PA_PAGE_ALIGN(m->size)) < 0) - AUDIO_ERR_LOG("munmap() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("munmap() failed: %{public}s", pa_cstrerror(errno)); #ifdef HAVE_SHM_OPEN if (m->type == PA_MEM_TYPE_SHARED_POSIX && m->do_unlink) { @@ -291,7 +289,7 @@ void pa_shm_free(pa_shm *m) { segment_name(fn, sizeof(fn), m->id); if (shm_unlink(fn) < 0) - AUDIO_ERR_LOG(" shm_unlink(%{public}s) failed: %{public}s", fn, pa_cstrerror(errno)); + pa_log_error(" shm_unlink(%{public}s) failed: %{public}s", fn, pa_cstrerror(errno)); } #endif #ifdef HAVE_MEMFD @@ -301,7 +299,7 @@ void pa_shm_free(pa_shm *m) { #else /* We shouldn't be here without shm or memfd support */ - AUDIO_ERR_LOG("remove pa_assert_not_reached call"); + pa_log_error("remove pa_assert_not_reached call"); #endif finish: @@ -371,7 +369,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) - AUDIO_ERR_LOG("shm_open() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("shm_open() failed: %{public}s", pa_cstrerror(errno)); goto fail; } break; @@ -387,20 +385,20 @@ static int shm_attach(pa_shm *m, pa_mem_type_t type, unsigned id, int memfd_fd, } if (fstat(fd, &st) < 0) { - AUDIO_ERR_LOG("fstat() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("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) { - AUDIO_ERR_LOG("Invalid shared memory segment size"); + pa_log_error("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) { - AUDIO_ERR_LOG("mmap() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("mmap() failed: %{public}s", pa_cstrerror(errno)); goto fail; } @@ -412,7 +410,7 @@ static int shm_attach(pa_shm *m, pa_mem_type_t type, unsigned id, int memfd_fd, if (type != PA_MEM_TYPE_SHARED_MEMFD) pa_assert_se(pa_close(fd) == 0); - AUDIO_INFO_LOG("shm_attach set mem type %{public}d", type); + pa_log_info("shm_attach set mem type %{public}d", type); m->type = type; m->id = id; m->size = (size_t) st.st_size; @@ -437,14 +435,14 @@ int pa_shm_attach(pa_shm *m, pa_mem_type_t type, unsigned id, int memfd_fd, bool } int pa_shm_cleanup(void) { - AUDIO_INFO_LOG("start pa_shm_cleanup"); + pa_log_info("start pa_shm_cleanup"); #ifdef HAVE_SHM_OPEN #ifdef SHM_PATH DIR *d; struct dirent *de; if (!(d = opendir(SHM_PATH))) { - AUDIO_WARNING_LOG("Failed to read "SHM_PATH": %s", pa_cstrerror(errno)); + pa_log_warn("Failed to read "SHM_PATH": %s", pa_cstrerror(errno)); return -1; } @@ -496,7 +494,7 @@ int pa_shm_cleanup(void) { segment_name(fn, sizeof(fn), id); if (shm_unlink(fn) < 0 && errno != EACCES && errno != ENOENT) - AUDIO_WARNING_LOG("Failed to remove SHM segment %{public}s: %{public}s", fn, pa_cstrerror(errno)); + pa_log_warn("Failed to remove SHM segment %{public}s: %{public}s", fn, pa_cstrerror(errno)); } closedir(d); diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index f63bdda8e..bd55febbc 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -1566,7 +1566,7 @@ bool pa_sink_input_is_passthrough(pa_sink_input *i) { /* Called from main context */ bool pa_sink_input_is_volume_readable(pa_sink_input *i) { pa_sink_input_assert_ref(i); - pa_assert_ctl_context(); + // pa_assert_ctl_context(); return !pa_sink_input_is_passthrough(i); } @@ -1574,7 +1574,7 @@ bool pa_sink_input_is_volume_readable(pa_sink_input *i) { /* Called from main context */ pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, bool absolute) { pa_sink_input_assert_ref(i); - pa_assert_ctl_context(); + // pa_assert_ctl_context(); pa_assert(PA_SINK_INPUT_IS_LINKED(i->state)); pa_assert(pa_sink_input_is_volume_readable(i)); @@ -2558,7 +2558,7 @@ void pa_sink_input_send_event(pa_sink_input *i, const char *event, pa_proplist * pa_sink_input_send_event_hook_data hook_data; pa_sink_input_assert_ref(i); - pa_assert_ctl_context(); + // pa_assert_ctl_context(); pa_assert(event); if (!i->send_event) -- Gitee From a3638de1e2fe4dd92be7b40022b539d1f37a1aa2 Mon Sep 17 00:00:00 2001 From: 134******51 Date: Mon, 23 Sep 2024 07:43:51 +0000 Subject: [PATCH 5/6] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20src/?= =?UTF-8?q?modules/alsa/mixer/samples/USB=20Device=200x46d:0x9a4--USB=20Mi?= =?UTF-8?q?xer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer diff --git a/src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer b/src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer deleted file mode 100644 index 783f826fc..000000000 --- a/src/modules/alsa/mixer/samples/USB Device 0x46d:0x9a4--USB Mixer +++ /dev/null @@ -1,5 +0,0 @@ -Simple mixer control 'Mic',0 - Capabilities: cvolume cvolume-joined cswitch cswitch-joined - Capture channels: Mono - Limits: Capture 0 - 3072 - Mono: Capture 1536 [50%] [23.00dB] [on] -- Gitee From 07efc218565f5d14b2e799179be882c175b73398 Mon Sep 17 00:00:00 2001 From: gao_ziyu Date: Mon, 23 Sep 2024 16:13:47 +0800 Subject: [PATCH 6/6] add log Signed-off-by: gao_ziyu --- src/pulsecore/shm.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c index 82b7f157b..dc48217aa 100644 --- a/src/pulsecore/shm.c +++ b/src/pulsecore/shm.c @@ -126,7 +126,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_error("mmap() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("mmap() failed: %s", pa_cstrerror(errno)); return -1; } #elif defined(HAVE_POSIX_MEMALIGN) @@ -134,7 +134,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_error("posix_memalign() failed: %{public}s", pa_cstrerror(r)); + pa_log_error("posix_memalign() failed: %s", pa_cstrerror(r)); return r; } } @@ -176,7 +176,7 @@ static int sharedmem_create(pa_shm *m, pa_mem_type_t type, size_t size, mode_t m } if (fd < 0) { - pa_log_error("%{public}s open() failed: %{public}s", pa_mem_type_to_string(type), pa_cstrerror(errno)); + pa_log_error("%s open() failed: %s", pa_mem_type_to_string(type), pa_cstrerror(errno)); goto fail; } @@ -185,7 +185,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_error("ftruncate() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("ftruncate() failed: %s", pa_cstrerror(errno)); goto fail; } @@ -194,7 +194,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_error("mmap() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("mmap() failed: %s", pa_cstrerror(errno)); goto fail; } @@ -255,7 +255,7 @@ static void privatemem_free(pa_shm *m) { #ifdef MAP_ANONYMOUS if (munmap(m->ptr, m->size) < 0) - pa_log_error("munmap() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("munmap() failed: %s", pa_cstrerror(errno)); #elif defined(HAVE_POSIX_MEMALIGN) free(m->ptr); #else @@ -277,11 +277,11 @@ void pa_shm_free(pa_shm *m) { goto finish; } - pa_log_info("mem type: %{public}d", m->type); + pa_log_info("mem type: %d", m->type); #if defined(HAVE_SHM_OPEN) || defined(HAVE_MEMFD) if (munmap(m->ptr, PA_PAGE_ALIGN(m->size)) < 0) - pa_log_error("munmap() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("munmap() failed: %s", pa_cstrerror(errno)); #ifdef HAVE_SHM_OPEN if (m->type == PA_MEM_TYPE_SHARED_POSIX && m->do_unlink) { @@ -289,7 +289,7 @@ void pa_shm_free(pa_shm *m) { segment_name(fn, sizeof(fn), m->id); if (shm_unlink(fn) < 0) - pa_log_error(" shm_unlink(%{public}s) failed: %{public}s", fn, pa_cstrerror(errno)); + pa_log_error(" shm_unlink(%s) failed: %s", fn, pa_cstrerror(errno)); } #endif #ifdef HAVE_MEMFD @@ -369,7 +369,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_error("shm_open() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("shm_open() failed: %s", pa_cstrerror(errno)); goto fail; } break; @@ -385,7 +385,7 @@ static int shm_attach(pa_shm *m, pa_mem_type_t type, unsigned id, int memfd_fd, } if (fstat(fd, &st) < 0) { - pa_log_error("fstat() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("fstat() failed: %s", pa_cstrerror(errno)); goto fail; } @@ -398,7 +398,7 @@ static int shm_attach(pa_shm *m, pa_mem_type_t type, unsigned id, int memfd_fd, 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_error("mmap() failed: %{public}s", pa_cstrerror(errno)); + pa_log_error("mmap() failed: %s", pa_cstrerror(errno)); goto fail; } @@ -410,7 +410,7 @@ static int shm_attach(pa_shm *m, pa_mem_type_t type, unsigned id, int memfd_fd, if (type != PA_MEM_TYPE_SHARED_MEMFD) pa_assert_se(pa_close(fd) == 0); - pa_log_info("shm_attach set mem type %{public}d", type); + pa_log_info("shm_attach set mem type %d", type); m->type = type; m->id = id; m->size = (size_t) st.st_size; @@ -494,7 +494,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 %{public}s: %{public}s", fn, pa_cstrerror(errno)); + pa_log_warn("Failed to remove SHM segment %s: %s", fn, pa_cstrerror(errno)); } closedir(d); -- Gitee