#include "qemu-common.h"
#include "qemu/main-loop.h"
#include "audio.h"
+#include "trace.h"
#if QEMU_GNUC_PREREQ(4, 3)
#pragma GCC diagnostic ignored "-Waddress"
int buffer_size_out_overridden;
int period_size_out_overridden;
- int verbose;
} ALSAConf;
struct pollhlp {
snd_pcm_state_t state;
struct pollhlp *hlp = opaque;
unsigned short revents;
- ALSAConf *conf = hlp->conf;
count = poll (hlp->pfds, hlp->count, 0);
if (count < 0) {
}
if (!(revents & hlp->mask)) {
- if (conf->verbose) {
- dolog ("revents = %d\n", revents);
- }
+ trace_alsa_revents(revents);
return;
}
{
int i, count, err;
struct pollfd *pfds;
- ALSAConf *conf = hlp->conf;
count = snd_pcm_poll_descriptors_count (handle);
if (count <= 0) {
qemu_set_fd_handler (pfds[i].fd, alsa_poll_handler, NULL, hlp);
}
if (pfds[i].events & POLLOUT) {
- if (conf->verbose) {
- dolog ("POLLOUT %d %d\n", i, pfds[i].fd);
- }
+ trace_alsa_pollout(i, pfds[i].fd);
qemu_set_fd_handler (pfds[i].fd, NULL, alsa_poll_handler, hlp);
}
- if (conf->verbose) {
- dolog ("Set handler events=%#x index=%d fd=%d err=%d\n",
- pfds[i].events, i, pfds[i].fd, err);
- }
+ trace_alsa_set_handler(pfds[i].events, i, pfds[i].fd, err);
}
hlp->pfds = pfds;
}
err = snd_pcm_hw_params_set_format (handle, hw_params, req->fmt);
- if (err < 0 && conf->verbose) {
+ if (err < 0) {
alsa_logerr2 (err, typ, "Failed to set format %d\n", req->fmt);
}
*handlep = handle;
- if (conf->verbose &&
- (obtfmt != req->fmt ||
+ if (obtfmt != req->fmt ||
obt->nchannels != req->nchannels ||
- obt->freq != req->freq)) {
+ obt->freq != req->freq) {
dolog ("Audio parameters for %s\n", typ);
alsa_dump_info (req, obt, obtfmt);
}
static void alsa_write_pending (ALSAVoiceOut *alsa)
{
HWVoiceOut *hw = &alsa->hw;
- ALSAConf *conf = alsa->pollhlp.conf;
while (alsa->pending) {
int left_till_end_samples = hw->samples - alsa->wpos;
if (written <= 0) {
switch (written) {
case 0:
- if (conf->verbose) {
- dolog ("Failed to write %d frames (wrote zero)\n", len);
- }
+ trace_alsa_wrote_zero(len);
return;
case -EPIPE:
len);
return;
}
- if (conf->verbose) {
- dolog ("Recovering from playback xrun\n");
- }
+ trace_alsa_xrun_out();
continue;
case -ESTRPIPE:
len);
return;
}
- if (conf->verbose) {
- dolog ("Resuming suspended output stream\n");
- }
+ trace_alsa_resume_out();
continue;
case -EAGAIN:
};
snd_pcm_sframes_t avail;
snd_pcm_uframes_t read_samples = 0;
- ALSAConf *conf = alsa->pollhlp.conf;
if (!dead) {
return 0;
dolog ("Failed to resume suspended input stream\n");
return 0;
}
- if (conf->verbose) {
- dolog ("Resuming suspended input stream\n");
- }
+ trace_alsa_resume_in();
break;
default:
- if (conf->verbose) {
- dolog ("No frames available and ALSA state is %d\n", state);
- }
+ trace_alsa_no_frames(state);
return 0;
}
}
if (nread <= 0) {
switch (nread) {
case 0:
- if (conf->verbose) {
- dolog ("Failed to read %ld frames (read zero)\n", len);
- }
+ trace_alsa_read_zero(len);
goto exit;
case -EPIPE:
alsa_logerr (nread, "Failed to read %ld frames\n", len);
goto exit;
}
- if (conf->verbose) {
- dolog ("Recovering from capture xrun\n");
- }
+ trace_alsa_xrun_in();
continue;
case -EAGAIN:
.valp = &glob_conf.pcm_name_in,
.descr = "ADC device name"
},
- {
- .name = "VERBOSE",
- .tag = AUD_OPT_BOOL,
- .valp = &glob_conf.verbose,
- .descr = "Behave in a more verbose way"
- },
{ /* End of list */ }
};
# hw/arm/virt-acpi-build.c
virt_acpi_setup(void) "No fw cfg or ACPI disabled. Bailing out."
+
+# audio/alsaaudio.c
+alsa_revents(int revents) "revents = %d"
+alsa_pollout(int i, int fd) "i = %d fd = %d"
+alsa_set_handler(int events, int index, int fd, int err) "events=%#x index=%d fd=%d err=%d"
+alsa_wrote_zero(int len) "Failed to write %d frames (wrote zero)"
+alsa_read_zero(long len) "Failed to read %ld frames (read zero)"
+alsa_xrun_out(void) "Recovering from playback xrun"
+alsa_xrun_in(void) "Recovering from capture xrun"
+alsa_resume_out(void) "Resuming suspended output stream"
+alsa_resume_in(void) "Resuming suspended input stream"
+alsa_no_frames(int state) "No frames available and ALSA state is %d"