]> git.alsa-project.org Git - alsa-utils.git/commitdiff
aplay: log pcm status before reporting a fatal error
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 27 Oct 2023 20:05:06 +0000 (15:05 -0500)
committerJaroslav Kysela <perex@perex.cz>
Tue, 12 Dec 2023 13:25:23 +0000 (14:25 +0100)
When the --fatal-errors happen, nothing is provided to the user even
when the '-v' verbose option is specified. This patch adds the fatal
error exit after dumping the logs. No functionality change, just
better information on what just happened.

Closes: https://github.com/alsa-project/alsa-utils/pull/242
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
aplay/aplay.c

index fc4bac697226c48fc8168512a3dc1b1421ddd85a..ed58a1ec8c7f002cb6e5fe030544655f624fb139 100644 (file)
@@ -1677,12 +1677,6 @@ static void xrun(void)
                prg_exit(EXIT_FAILURE);
        }
        if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
-               if (fatal_errors) {
-                       error(_("fatal %s: %s"),
-                                       stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"),
-                                       snd_strerror(res));
-                       prg_exit(EXIT_FAILURE);
-               }
                if (monotonic) {
 #ifdef HAVE_CLOCK_GETTIME
                        struct timespec now, diff, tstamp;
@@ -1708,6 +1702,12 @@ static void xrun(void)
                        fprintf(stderr, _("Status:\n"));
                        snd_pcm_status_dump(status, log);
                }
+               if (fatal_errors) {
+                       error(_("fatal %s: %s"),
+                                       stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"),
+                                       snd_strerror(res));
+                       prg_exit(EXIT_FAILURE);
+               }
                if ((res = snd_pcm_prepare(handle))<0) {
                        error(_("xrun: prepare error: %s"), snd_strerror(res));
                        prg_exit(EXIT_FAILURE);