File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Android/APIExample/lib-screensharing/src/main/java/io/agora/rtc/ss/gles Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ public class GLRender {
5454 private LinkedList <Runnable > mGLDrawTaskList ;
5555 private final Object mDrawLock = new Object ();
5656
57+ private final static int frameRate = 30 ;
58+ private long mLastFrameTime ;
59+
60+
5761 private Runnable runnableDrawFrame = new Runnable () {
5862 public void run () {
5963 doDrawFrame ();
@@ -196,6 +200,14 @@ public void onResume() {
196200 }
197201
198202 public void requestRender () {
203+ long tm = System .currentTimeMillis ();
204+ long tmDiff = tm - mLastFrameTime ;
205+ if (tmDiff < (1000 / frameRate )) {
206+ Log .v (TAG , "drawing too often, drop this frame... " );
207+ return ;
208+ }
209+ mLastFrameTime = tm ;
210+
199211 if (mGLSurfaceView != null ) {
200212 mGLSurfaceView .requestRender ();
201213 }
You can’t perform that action at this time.
0 commit comments