bsdaudio: this appears to be using the wrong variable...?
authorRyan C. Gordon <icculus@icculus.org>
Wed, 03 Aug 2016 01:56:58 -0400
changeset 10232 216367257386
parent 10231 0bd26418c5e4
child 10233 449a75328029
bsdaudio: this appears to be using the wrong variable...? (We probably never noticed because this is meant to block until it fully writes a buffer, and would only trigger an issue if we had a short write that wasn't otherwise an error condition.)
src/audio/bsd/SDL_bsdaudio.c
--- a/src/audio/bsd/SDL_bsdaudio.c	Wed Aug 03 01:53:59 2016 -0400
+++ b/src/audio/bsd/SDL_bsdaudio.c	Wed Aug 03 01:56:58 2016 -0400
@@ -182,11 +182,15 @@
             break;
         }
 
-        if (p < written
+#ifdef DEBUG_AUDIO
+        fprintf(stderr, "Wrote %d bytes of audio data\n", written);
+#endif
+
+        if (p < this->hidden->mixlen
             || ((written < 0) && ((errno == 0) || (errno == EAGAIN)))) {
             SDL_Delay(1);       /* Let a little CPU time go by */
         }
-    } while (p < written);
+    } while (p < this->hidden->mixlen);
 
     /* If timer synchronization is enabled, set the next write frame */
     if (this->hidden->frame_ticks) {
@@ -197,9 +201,6 @@
     if (written < 0) {
         SDL_OpenedAudioDeviceDisconnected(this);
     }
-#ifdef DEBUG_AUDIO
-    fprintf(stderr, "Wrote %d bytes of audio data\n", written);
-#endif
 }
 
 static Uint8 *