@samitouri / QOSamiQemu / commits / c268bf4c7a

audio: replace DEBUG_OUT with traces

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 21, 2026 at 15:53 UTC c268bf4c7a20947ae9ba5774a78f4de72cff140c
2 files changed +13 -24
audio/audio-mixeng-be.c
+8 -24
@@ -29,8 +29,6 @@
29 #define AUDIO_CAP "audio"
30 #include "audio_int.h"
31
32 -/* #define DEBUG_OUT */
33 -
32 #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown"
33
34 const struct mixeng_volume nominal_volume = {
@@ -568,9 +566,7 @@ static size_t audio_pcm_sw_write(SWVoiceOut *sw, void *buf, size_t buf_len)
566 }
567
568 if (live == hw->mix_buf.size) {
571 -#ifdef DEBUG_OUT
572 - dolog ("%s is full %zu\n", sw->name, live);
573 -#endif
569 + trace_audio_out_full(sw->name, live);
570 return 0;
571 }
572
@@ -618,15 +614,8 @@ static size_t audio_pcm_sw_write(SWVoiceOut *sw, void *buf, size_t buf_len)
614 sw->resample_buf.pos = 0;
615 }
616
621 -#ifdef DEBUG_OUT
622 - dolog (
623 - "%s: write size %zu written %zu total mixed %zu\n",
624 - SW_NAME(sw),
625 - buf_len / sw->info.bytes_per_frame,
626 - total_in,
627 - sw->total_hw_samples_mixed
628 - );
629 -#endif
617 + trace_audio_sw_write(SW_NAME(sw), buf_len / sw->info.bytes_per_frame,
618 + total_in, sw->total_hw_samples_mixed);
619
620 return total_in * sw->info.bytes_per_frame;
621 }
@@ -900,10 +889,8 @@ static size_t audio_get_free(SWVoiceOut *sw)
889
890 dead = sw->hw->mix_buf.size - live;
891
903 -#ifdef DEBUG_OUT
904 - dolog("%s: get_free live %zu dead %zu frontend frames %u\n",
905 - SW_NAME(sw), live, dead, st_rate_frames_in(sw->rate, dead));
906 -#endif
892 + trace_audio_get_free(SW_NAME(sw), live, dead,
893 + st_rate_frames_in(sw->rate, dead));
894
895 return dead;
896 }
@@ -1058,9 +1045,8 @@ static void audio_run_out(AudioMixengBackend *s)
1045
1046 if (hw->pending_disable && !nb_live) {
1047 SWVoiceCap *sc;
1061 -#ifdef DEBUG_OUT
1062 - dolog ("Disabling voice\n");
1063 -#endif
1048 +
1049 + trace_audio_out_disable();
1050 hw->enabled = false;
1051 hw->pending_disable = false;
1052 if (k->enable_out) {
@@ -1089,9 +1075,7 @@ static void audio_run_out(AudioMixengBackend *s)
1075 hw->mix_buf.pos = 0;
1076 }
1077
1092 -#ifdef DEBUG_OUT
1093 - dolog("played=%zu\n", played);
1094 -#endif
1078 + trace_audio_out_played(played);
1079
1080 if (played) {
1081 audio_capture_mix_and_clear (hw, prev_rpos, played);
audio/trace-events
+5
@@ -65,6 +65,11 @@ audio_capture_attach(const char *name, bool active) "capture %s active=%d"
65 audio_get_avail(const char *name, size_t live, uint32_t frontend_frames) "%s: get_avail live %zu frontend frames %u"
66 audio_run_poll(const char *msg, int64_t elapsed_us) "Elapsed since last %s: %" PRId64 " us"
67 audio_capture_free_sw(const char *name) "freeing %s"
68 +audio_out_full(const char *name, size_t live) "%s is full %zu"
69 +audio_sw_write(const char *name, size_t size, size_t written, size_t total_mixed) "%s: write size %zu written %zu total mixed %zu"
70 +audio_get_free(const char *name, size_t live, size_t dead, uint32_t frontend_frames) "%s: get_free live %zu dead %zu frontend frames %u"
71 +audio_out_disable(void) "Disabling voice"
72 +audio_out_played(size_t played) "played=%zu"
73
74 # audio_template.h
75 audio_open_out(const char *name, int freq, int nchannels, int fmt) "open %s, freq %d, nchannels %d, fmt %d"