From 7b76c97de92a65cc8347c855cc89af517ad2e8f9 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 24 Aug 2021 15:26:12 -0400 Subject: alsasink: Improve logging in write() function This moves the "written X frames" lower so that we don't trace confusing negative values on errors and add the error code in the "Write error" log. Part-of: --- ext/alsa/gstalsasink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index 09ee1ea58..6d7278825 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -1072,9 +1072,8 @@ gst_alsasink_write (GstAudioSink * asink, gpointer data, guint length) GST_DELAY_SINK_UNLOCK (asink); } - GST_DEBUG_OBJECT (asink, "written %d frames out of %d", err, cptr); if (err < 0) { - GST_DEBUG_OBJECT (asink, "Write error: %s", snd_strerror (err)); + GST_DEBUG_OBJECT (asink, "Write error: %s (%d)", snd_strerror (err), err); if (err == -EAGAIN) { continue; } else if (err == -ENODEV) { @@ -1089,6 +1088,7 @@ gst_alsasink_write (GstAudioSink * asink, gpointer data, guint length) break; } + GST_DEBUG_OBJECT (asink, "written %d frames out of %d", err, cptr); ptr += snd_pcm_frames_to_bytes (alsa->handle, err); cptr -= err; } -- cgit v1.2.1