OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 12 matching lines...) Expand all Loading... |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 package org.webrtc; | 28 package org.webrtc; |
29 | 29 |
30 import android.content.Context; | 30 import android.content.Context; |
31 import android.graphics.Point; | 31 import android.graphics.Point; |
32 import android.graphics.SurfaceTexture; | 32 import android.graphics.SurfaceTexture; |
33 import android.opengl.EGLContext; | |
34 import android.opengl.GLES20; | 33 import android.opengl.GLES20; |
35 import android.opengl.Matrix; | 34 import android.opengl.Matrix; |
36 import android.os.Handler; | 35 import android.os.Handler; |
37 import android.os.HandlerThread; | 36 import android.os.HandlerThread; |
38 import android.util.AttributeSet; | 37 import android.util.AttributeSet; |
39 import android.view.SurfaceHolder; | 38 import android.view.SurfaceHolder; |
40 import android.view.SurfaceView; | 39 import android.view.SurfaceView; |
41 | 40 |
42 import org.webrtc.Logging; | 41 import org.webrtc.Logging; |
43 | 42 |
| 43 import javax.microedition.khronos.egl.EGLContext; |
| 44 |
44 /** | 45 /** |
45 * Implements org.webrtc.VideoRenderer.Callbacks by displaying the video stream
on a SurfaceView. | 46 * Implements org.webrtc.VideoRenderer.Callbacks by displaying the video stream
on a SurfaceView. |
46 * renderFrame() is asynchronous to avoid blocking the calling thread. | 47 * renderFrame() is asynchronous to avoid blocking the calling thread. |
47 * This class is thread safe and handles access from potentially four different
threads: | 48 * This class is thread safe and handles access from potentially four different
threads: |
48 * Interaction from the main app in init, release, setMirror, and setScalingtype
. | 49 * Interaction from the main app in init, release, setMirror, and setScalingtype
. |
49 * Interaction from C++ webrtc::VideoRendererInterface in renderFrame and canApp
lyRotation. | 50 * Interaction from C++ webrtc::VideoRendererInterface in renderFrame and canApp
lyRotation. |
50 * Interaction from the Activity lifecycle in surfaceCreated, surfaceChanged, an
d surfaceDestroyed. | 51 * Interaction from the Activity lifecycle in surfaceCreated, surfaceChanged, an
d surfaceDestroyed. |
51 * Interaction with the layout framework in onMeasure and onSizeChanged. | 52 * Interaction with the layout framework in onMeasure and onSizeChanged. |
52 */ | 53 */ |
53 public class SurfaceViewRenderer extends SurfaceView | 54 public class SurfaceViewRenderer extends SurfaceView |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 if (framesReceived > 0 && framesRendered > 0) { | 527 if (framesReceived > 0 && framesRendered > 0) { |
527 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; | 528 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; |
528 Logging.d(TAG, "Duration: " + (int) (timeSinceFirstFrameNs / 1e6) + | 529 Logging.d(TAG, "Duration: " + (int) (timeSinceFirstFrameNs / 1e6) + |
529 " ms. FPS: " + (float) framesRendered * 1e9 / timeSinceFirstFrameNs)
; | 530 " ms. FPS: " + (float) framesRendered * 1e9 / timeSinceFirstFrameNs)
; |
530 Logging.d(TAG, "Average render time: " | 531 Logging.d(TAG, "Average render time: " |
531 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); | 532 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); |
532 } | 533 } |
533 } | 534 } |
534 } | 535 } |
535 } | 536 } |
OLD | NEW |