[xray] show only 1% of dropped frames

This commit is contained in:
nick black 2021-12-04 03:54:44 -05:00
parent 1c93a5ff45
commit 6c4c16465b
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -115,10 +115,10 @@ get_next_frame(struct marsh* m, struct ncvisual_options* vopts){
uint64_t ns = clock_getns(CLOCK_MONOTONIC); uint64_t ns = clock_getns(CLOCK_MONOTONIC);
int ret = m->next_frame; int ret = m->next_frame;
uint64_t deadline = m->startns + (m->next_frame + 1) * MAX_SECONDS * (NANOSECS_IN_SEC / VIDEO_FRAMES); uint64_t deadline = m->startns + (m->next_frame + 1) * MAX_SECONDS * (NANOSECS_IN_SEC / VIDEO_FRAMES);
// if we've missed the deadline, drop the frame 95% of the time (you've still // if we've missed the deadline, drop the frame 99% of the time (you've still
// got to draw now and again, or else there's just the initial frame hanging // got to draw now and again, or else there's just the initial frame hanging
// there for ~900 frames of crap). // there for ~900 frames of crap).
if(ns > deadline && (rand() % 20)){ if(ns > deadline && (rand() % 100)){
ncplane_destroy(vopts->n); ncplane_destroy(vopts->n);
vopts->n = NULL; vopts->n = NULL;
}else if(ncvisual_blit(m->nc, m->ncv, vopts) == NULL){ }else if(ncvisual_blit(m->nc, m->ncv, vopts) == NULL){