private void updateFrameBuffer ( ) { LOG . trace ( "Next frame" ) ; if ( t1 == - 1 || t2 == - 1 ) { t1 = System . currentTimeMillis ( ) ; t2 = System . currentTimeMillis ( ) ; } int result = new NextFrameTask ( this ) . nextFrame ( ) ; t1 = t2 ; t2 = System . currentTimeMillis ( ) ; fps = ( 4 * fps + 1000 / ( t2 - t1 + 1 ) ) / 5 ; if ( result == - 1 ) { LOG . error ( "Timeout when requesting image!" ) ; } else if ( result < - 1 ) { LOG . error ( "Error requesting new frame!" ) ; } }
Update underlying memory buffer and fetch new frame .