audio/jack: replace custom logging with report & trace
Replace the custom audio logging infrastructure with standard QEMU error reporting and tracing. Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Marc-André Lureau committed
Jan 20, 2026 at 19:14 UTC
167af3829d65fe06a76098f956aa646d46c4df58
2 files changed
+22
-16
audio/jackaudio.c
+13
-16
@@ -26,11 +26,11 @@
26
#include "qemu/module.h"
27
#include "qemu/atomic.h"
28
#include "qemu/main-loop.h"
29
+#include "qemu/error-report.h"
30
#include "qemu/audio.h"
31
#include "qom/object.h"
31
-
32
-#define AUDIO_CAP "jack"
32
#include "audio_int.h"
33
+#include "trace.h"
34
35
#include <jack/jack.h>
36
#include <jack/thread.h>
@@ -343,7 +343,7 @@ static void qjack_client_recover(QJackClient *c)
343
344
/* if enabled then attempt to recover */
345
if (c->enabled) {
346
- dolog("attempting to reconnect to server\n");
346
+ trace_jack_client_recover();
347
qjack_client_init(c);
348
}
349
}
@@ -399,10 +399,10 @@ static void qjack_client_connect_ports(QJackClient *c)
399
}
400
401
if (c->out) {
402
- dolog("connect %s -> %s\n", p, ports[i]);
402
+ trace_jack_connect(p, ports[i]);
403
jack_connect(c->client, p, ports[i]);
404
} else {
405
- dolog("connect %s -> %s\n", ports[i], p);
405
+ trace_jack_connect(ports[i], p);
406
jack_connect(c->client, ports[i], p);
407
}
408
}
@@ -441,9 +441,9 @@ static int qjack_client_init(QJackClient *c)
441
c->opt->server_name);
442
443
if (c->client == NULL) {
444
- dolog("jack_client_open failed: status = 0x%2.0x\n", status);
444
+ error_report("jack: jack_client_open failed: status = 0x%2.0x", status);
445
if (status & JackServerFailed) {
446
- dolog("unable to connect to JACK server\n");
446
+ error_report("jack: unable to connect to JACK server");
447
}
448
return -1;
449
}
@@ -451,12 +451,11 @@ static int qjack_client_init(QJackClient *c)
451
c->freq = jack_get_sample_rate(c->client);
452
453
if (status & JackServerStarted) {
454
- dolog("JACK server started\n");
454
+ trace_jack_server_started();
455
}
456
457
if (status & JackNameNotUnique) {
458
- dolog("JACK unique name assigned %s\n",
459
- jack_get_client_name(c->client));
458
+ trace_jack_unique_name(jack_get_client_name(c->client));
459
}
460
461
/* Allocate working buffer for process callback */
@@ -536,8 +535,7 @@ static int qjack_init_out(HWVoiceOut *hw, struct audsettings *as)
535
};
536
audio_pcm_init_info(&hw->info, &os);
537
539
- dolog("JACK output configured for %dHz (%d samples)\n",
540
- jo->c.freq, jo->c.buffersize);
538
+ trace_jack_out_init(jo->c.freq, jo->c.buffersize);
539
540
return 0;
541
}
@@ -572,8 +570,7 @@ static int qjack_init_in(HWVoiceIn *hw, struct audsettings *as)
570
};
571
audio_pcm_init_info(&hw->info, &is);
572
575
- dolog("JACK input configured for %dHz (%d samples)\n",
576
- ji->c.freq, ji->c.buffersize);
573
+ trace_jack_in_init(ji->c.freq, ji->c.buffersize);
574
575
return 0;
576
}
@@ -654,12 +651,12 @@ static int qjack_thread_creator(jack_native_thread_t *thread,
651
652
static void qjack_error(const char *msg)
653
{
657
- dolog("E: %s\n", msg);
654
+ error_report("jack: %s", msg);
655
}
656
657
static void qjack_info(const char *msg)
658
{
662
- dolog("I: %s\n", msg);
659
+ trace_jack_info(msg);
660
}
661
662
static void audio_jack_class_init(ObjectClass *klass, const void *data)
audio/trace-events
+9
@@ -28,6 +28,15 @@ dsound_clear_sample(void *p1, uint32_t blen1, uint32_t len1, void *p2, uint32_t
28
dsound_wave_format(uint16_t wFormatTag, uint16_t nChannels, uint32_t nSamplesPerSec, uint32_t nAvgBytesPerSec, uint16_t nBlockAlign, uint16_t wBitsPerSample, uint16_t cbSize) "wFormatTag=%u, nChannels=%u, nSamplesPerSec=%u, nAvgBytesPerSec=%u, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u"
29
dsound_buffer_bytes(uint32_t caps_bytes, uint32_t desc_bytes) "caps_bytes=%u, desc_bytes=%u"
30
31
+# jackaudio.c
32
+jack_client_recover(void) "attempting to reconnect to server"
33
+jack_connect(const char *src, const char *dst) "connect %s -> %s"
34
+jack_server_started(void) "server started"
35
+jack_unique_name(const char *name) "unique name assigned %s"
36
+jack_out_init(uint32_t freq, int buffersize) "output configured for %uHz (%d samples)"
37
+jack_in_init(uint32_t freq, int buffersize) "input configured for %uHz (%d samples)"
38
+jack_info(const char *msg) "%s"
39
+
40
# pwaudio.c
41
pw_state_changed(int nodeid, const char *s) "node id: %d stream state: %s"
42
pw_read(int32_t avail, uint32_t index, size_t len) "avail=%d index=%u len=%zu"