You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// allNotifications reference here is only the first value
18
-
// TODO: refactor this clumbsy approach (in every usage)
19
-
allNotifications.captureStats=`${frameCount} frames in ${secondsElapsed}s, or ${friendlyRound(frameCount/secondsElapsed)} fps (${friendlyRound(secondsElapsed/frameCount)} spf)`;
22
+
// TODO: refactor this clumsy approach (in every usage)
23
+
allNotifications.captureStats=''
24
+
+`captured ${capturedFrameCount} frames in ${secondsElapsed}s, or ${friendlyRound(capturedFrameCount/secondsElapsed)} fps (${friendlyRound(secondsElapsed/capturedFrameCount)} spf)\n`
25
+
+`saved ${savedFrameCount} frames in ${secondsElapsed}s, or ${friendlyRound(savedFrameCount/secondsElapsed)} fps (${friendlyRound(secondsElapsed/savedFrameCount)} spf)`;
console.log(`captured ${stats.capturedFrameCount} in ${secondsElapsed}s, or ${stats.capturedFrameCount/secondsElapsed} fps (${secondsElapsed/stats.capturedFrameCount} spf)`);
206
+
});
207
+
208
+
constsaveFrame=saveFramePromise
194
209
.then(()=>{
195
-
constpresentStats={ ...stats};
196
-
presentStats.frameCount+=1;
210
+
// stats could be updated in multiple Promise branches, need the same instance
211
+
// eslint-disable-next-line no-param-reassign
212
+
stats.savedFrameCount+=1;
197
213
constnow=Date.now();
198
-
projectorEvents.emit('captureStats',{ ...presentStats, now });
console.log(`${presentStats.frameCount} in ${secondsElapsed}s, or ${presentStats.frameCount/secondsElapsed} fps (${secondsElapsed/presentStats.frameCount} spf)`);
214
+
projectorEvents.emit('captureStats',{ ...stats, now });
console.log(`saved ${stats.savedFrameCount} in ${secondsElapsed}s, or ${stats.savedFrameCount/secondsElapsed} fps (${secondsElapsed/stats.savedFrameCount} spf)`);
217
+
});
218
+
219
+
// FIXME: wait for these filesystem operations to finish if they're taking too long
220
+
// currently, they're 1-3ms total, while taking a picture and cropping take around 700ms each
0 commit comments