From 2c9966150099d1e9270ecdc73ab7158d60c1cb82 Mon Sep 17 00:00:00 2001 From: Brett Renfer Date: Thu, 10 Apr 2014 11:26:25 -0400 Subject: [PATCH] Adding a basic interval to streaming video --- example_binary_stream/src/ofApp.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/example_binary_stream/src/ofApp.cpp b/example_binary_stream/src/ofApp.cpp index 78e012c..8044516 100644 --- a/example_binary_stream/src/ofApp.cpp +++ b/example_binary_stream/src/ofApp.cpp @@ -3,6 +3,8 @@ ofBuffer buff, inBuff; ofImage test, test2; bool bLoad = false; +int sendInterval = 500; +int lastSent = 0; //-------------------------------------------------------------- void ofApp::setup(){ @@ -23,8 +25,8 @@ void ofApp::update(){ } // outgoing grabber.update(); - if ( grabber.isFrameNew() ){ - + if ( grabber.isFrameNew() && ofGetElapsedTimeMillis() - lastSent > sendInterval ){ + lastSent = ofGetElapsedTimeMillis(); unsigned long size = 0; unsigned char * data = jpeg.compress(grabber, 50, &size);