shithub: hj264

Download patch

ref: f70190d3c1b0f3e52bf9b53caf9a883da7579fbe
parent: 4606f66a846dc52420ef0ddfaa60449393f846ab
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Thu Aug 5 07:05:50 EDT 2021

procrfork & threadexitsall

--- a/hj264.c
+++ b/hj264.c
@@ -108,7 +108,7 @@
 	chanfree(done);
 	chanfree(job);
 
-	threadexits(nil);
+	threadexitsall(nil);
 }
 
 static void
@@ -207,7 +207,7 @@
 		t->id = i;
 		t->job = chancreate(sizeof(void*), 0);
 		t->done = chancreate(sizeof(void*), 0);
-		proccreate(threadf, t, mainstacksize);
+		procrfork(threadf, t, mainstacksize, RFCFDG|RFCENVG);
 		recvp(t->done);
 	}
 
@@ -279,12 +279,13 @@
 
 	Bflush(&h->out);
 
+	chanclose(h->frame);
 	if(h->done != nil)
 		sendp(h->done, nil);
 
 	free(prev);
 
-	threadexits(nil);
+	threadexitsall(nil);
 }
 
 static Img *
@@ -438,7 +439,7 @@
 	}
 	*procdata() = h;
 	threadnotify(done, 1);
-	proccreate(encthread, h, mainstacksize);
+	procrfork(encthread, h, mainstacksize, RFCENVG);
 
 	if(h->fmt == FmtIVF){
 		Bwrite(&h->out, "DKIF\x00\x00\x20\x00AVC1", 12);