spa: alsa: pcm: log_write(): return early if log level is disabled

If the "debug" log level is not enabled for the "spa.alsa" log topic,
then there is no point in going into the loop and splitting the data
into lines, so skip that.
This commit is contained in:
Barnabás Pőcze 2026-05-06 22:00:04 +02:00 committed by Wim Taymans
parent 320fe9a6a0
commit bf57911b83

View file

@ -715,6 +715,9 @@ static ssize_t log_write(void *cookie, const char *buf, size_t size)
{
struct state *state = cookie;
if (!spa_log_level_topic_enabled(state->log, SPA_LOG_TOPIC_DEFAULT, SPA_LOG_LEVEL_DEBUG))
return size;
for (size_t left = size; left > 0; ) {
const char *end = memchr(buf, '\n', left);
size_t len = end ? end - buf : left;