ref: 272d632955a70c61cef5d92403cdad89aff41387
parent: 4ce14a7e0fc4c27895af0a3281c032b7e1890d10
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Sep 14 19:16:04 EDT 2020
drain the audio stream before finishing
--- a/main.c
+++ b/main.c
@@ -105,6 +105,7 @@
Cresize,
Cnum,
};
+ Streamframe f;
Frame *frame;
Mousectl *mctl;
Keyboardctl *kctl;
@@ -195,8 +196,8 @@
res = alt(a);
switch(res){
case Cframe:
- drawframe(frame);
runaudio(saudio);
+ drawframe(frame);
break;
case Cplayerdone:
@@ -221,6 +222,13 @@
flushimage(display, 1);
unlockdisplay(display);
break;
+ }
+
+
+ for(; !end && audiofd >= 0 && saudio != nil;){
+ if(Sread(saudio, &f) != 0 || f.sz == 0)
+ break;
+ write(audiofd, f.buf, f.sz);
}
}