]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Always record frames successfully sent to DAC even if they are less than requested.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Tue, 15 Mar 2022 23:19:15 +0000 (10:19 +1100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Tue, 15 Mar 2022 23:19:15 +0000 (10:19 +1100)
audio_alsa.c

index d02c8a78b1aa4e25ecfa8ed2a681057d69cc0f53..373b1db9040efd01241cc2bbf90b25d11e86fd50 100644 (file)
@@ -1727,9 +1727,10 @@ int do_play(void *buf, int samples) {
       snd_pcm_state_t prior_state = state; // keep this for afterwards....
       // debug(3, "alsa: write %d frames.", samples);
       ret = alsa_pcm_write(alsa_handle, buf, samples);
+      if (ret > 0)
+        frames_sent_for_playing += ret; // this is the number of frames accepted
       if (ret == samples) {
         stall_monitor_frame_count += samples;
-        frames_sent_for_playing += samples;
       } else {
         frames_sent_break_occurred = 1; // note than an output error has occurred
         if (ret == -EPIPE) {            /* underrun */