ref: f11d1a90ff9b077e5d93b8a4636f8b1f142b3786
parent: f98c80c2600e237274c8b9910aa797adb7272184
author: Sigrid Haflínudóttir <[email protected]>
date: Mon Sep 7 06:15:02 EDT 2020
set maxframes to NPROC
--- a/src/av19.c
+++ b/src/av19.c
@@ -33,16 +33,13 @@
// FIXME why does it need this much?
int mainstacksize = 512*1024;
-enum {
- Maxframes = 4,
-};
-
static Player *curplayer;
static Image *curim;
-static Channel *converters[Maxframes];
+static Channel **converters;
static QLock framelock;
static uvlong todisplay;
static int resize = 1;
+static int maxframes;
/* yuv→rgb by Adrien Descamps */
@@ -221,7 +218,7 @@
}
}else{
f->n = p->n++;
- sendp(converters[f->n % Maxframes], f);
+ sendp(converters[f->n % maxframes], f);
}
}
}while(p->data.sz > 0 || input_read(p->dc, &p->data) == 0);
@@ -362,6 +359,7 @@
};
Mousectl *mctl;
Keyboardctl *kctl;
+ char *s;
Rune key;
Mouse m;
int i, end, done;
@@ -394,7 +392,11 @@
a[Cresize].c = mctl->resizec;
a[Ckeyboard].c = kctl->c;
- for(i = 0; i < nelem(converters); i++){
+ maxframes = atoi((s = getenv("NPROC")) != nil ? s : "1");
+ if(maxframes < 1)
+ maxframes = 1;
+ converters = calloc(maxframes, sizeof(*converters));
+ for(i = 0; i < maxframes; i++){
converters[i] = chancreate(sizeof(Frame*), 0);
proccreate(converterproc, converters[i], 4096);
}