History

do not stuck when mcfs failed to extract audio

Sigrid Solveig Haflínudóttir committed 5 years ago

Commit 14a76c31 parent eee770d1 file · +11 −12Browse files

Unified · Split

main.c+11−12
@@ -29,20 +29,26 @@ audioproc(void *x) · 28 unmodified lines
29{29{
30 Streamframe f;30 Streamframe f;
31 Stream *s;31 Stream *s;
32 int audiofd;32 int audiofd, synced;
33 33
34 synced = 0;
34 if((audiofd = open("/dev/audio", OWRITE|OCEXEC)) < 0){35 if((audiofd = open("/dev/audio", OWRITE|OCEXEC)) < 0){
35 fprint(2, "runaudio: %r\n");36 fprint(2, "runaudio: %r\n");
36 recvp(audiosync);
37 chanclose(audiosync);
38 }else{37 }else{
39 for(s = x; Sread(s, &f) == 0 && f.sz > 0;){38 for(s = x; Sread(s, &f) == 0 && f.sz > 0;){
40 recvp(audiosync);39 if(!synced){
41 chanclose(audiosync);40 recvp(audiosync);
41 chanclose(audiosync);
42 synced = 1;
43 }
42 write(audiofd, f.buf, f.sz);44 write(audiofd, f.buf, f.sz);
43 }45 }
44 close(audiofd);46 close(audiofd);
45 }47 }
48 if(!synced){
49 recvp(audiosync);
50 chanclose(audiosync);
51 }
46 52
47 sendp(audiofinished, nil);53 sendp(audiofinished, nil);
48 54
@@ -140,7 +146,6 @@ threadmain(int argc, char **argv) · 91 unmodified lines
140 Cresize,146 Cresize,
141 Cnum,147 Cnum,
142 };148 };
143 Streamframe f;
144 Frame *frame;149 Frame *frame;
145 Mousectl *mctl;150 Mousectl *mctl;
146 Keyboardctl *kctl;151 Keyboardctl *kctl;
@@ -285,12 +290,6 @@ threadmain(int argc, char **argv) · 138 unmodified lines
285 unlockdisplay(display);290 unlockdisplay(display);
286 break;291 break;
287 }292 }
288
289 for(; !end && audiofd >= 0 && saudio != nil;){
290 if(Sread(saudio, &f) != 0 || f.sz == 0)
291 break;
292 write(audiofd, f.buf, f.sz);
293 }
294 }293 }
295 294
296 if(forced && saudio != nil){295 if(forced && saudio != nil){

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t