// Pass through input frame
Frame input = pullInput("frame");
pushOutput("frame", input);
// Update stats
++mTotalFrameCount;
++mPeriodFrameCount;
// Check clock
if (mLastTime == 0) {
mLastTime = SystemClock.elapsedRealtime();
}
long curTime = SystemClock.elapsedRealtime();
// Output throughput info if time period is up
if ((curTime - mLastTime) >= (mPeriod * 1000)) {
FrameFormat inputFormat = input.getFormat();
int pixelCount = inputFormat.getWidth() * inputFormat.getHeight();
Throughput throughput = new Throughput(mTotalFrameCount,
mPeriodFrameCount,
mPeriod,
pixelCount);
Frame throughputFrame = context.getFrameManager().newFrame(mOutputFormat);
throughputFrame.setObjectValue(throughput);
pushOutput("throughput", throughputFrame);
mLastTime = curTime;
mPeriodFrameCount = 0;
}