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 10 matching lines...) Expand all Loading... |
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
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.graphics.SurfaceTexture; | 30 import android.graphics.SurfaceTexture; |
31 import android.opengl.EGLContext; | |
32 import android.opengl.GLES11Ext; | 31 import android.opengl.GLES11Ext; |
33 import android.opengl.GLES20; | 32 import android.opengl.GLES20; |
34 import android.os.Build; | 33 import android.os.Build; |
35 import android.os.Handler; | 34 import android.os.Handler; |
36 import android.os.HandlerThread; | 35 import android.os.HandlerThread; |
37 import android.os.SystemClock; | 36 import android.os.SystemClock; |
38 | 37 |
39 import java.util.concurrent.Callable; | 38 import java.util.concurrent.Callable; |
40 import java.util.concurrent.CountDownLatch; | 39 import java.util.concurrent.CountDownLatch; |
41 import java.util.concurrent.TimeUnit; | 40 import java.util.concurrent.TimeUnit; |
42 | 41 |
| 42 import javax.microedition.khronos.egl.EGLContext; |
| 43 |
43 /** | 44 /** |
44 * Helper class to create and synchronize access to a SurfaceTexture. The caller
will get notified | 45 * Helper class to create and synchronize access to a SurfaceTexture. The caller
will get notified |
45 * of new frames in onTextureFrameAvailable(), and should call returnTextureFram
e() when done with | 46 * of new frames in onTextureFrameAvailable(), and should call returnTextureFram
e() when done with |
46 * the frame. Only one texture frame can be in flight at once, so returnTextureF
rame() must be | 47 * the frame. Only one texture frame can be in flight at once, so returnTextureF
rame() must be |
47 * called in order to receive a new frame. Call disconnect() to stop receiveing
new frames and | 48 * called in order to receive a new frame. Call disconnect() to stop receiveing
new frames and |
48 * release all resources. | 49 * release all resources. |
49 * Note that there is a C++ counter part of this class that optionally can be us
ed. It is used for | 50 * Note that there is a C++ counter part of this class that optionally can be us
ed. It is used for |
50 * wrapping texture frames into webrtc::VideoFrames and also handles calling ret
urnTextureFrame() | 51 * wrapping texture frames into webrtc::VideoFrames and also handles calling ret
urnTextureFrame() |
51 * when the webrtc::VideoFrame is no longer used. | 52 * when the webrtc::VideoFrame is no longer used. |
52 */ | 53 */ |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 220 } |
220 eglBase.makeCurrent(); | 221 eglBase.makeCurrent(); |
221 GLES20.glDeleteTextures(1, new int[] {oesTextureId}, 0); | 222 GLES20.glDeleteTextures(1, new int[] {oesTextureId}, 0); |
222 surfaceTexture.release(); | 223 surfaceTexture.release(); |
223 eglBase.release(); | 224 eglBase.release(); |
224 if (isOwningThread) { | 225 if (isOwningThread) { |
225 handler.getLooper().quitSafely(); | 226 handler.getLooper().quitSafely(); |
226 } | 227 } |
227 } | 228 } |
228 } | 229 } |
OLD | NEW |