@@ -89,22 +89,6 @@ public void run() {
89
89
mCameraHandler = new CameraHandler (Capture .this );
90
90
}
91
91
});
92
-
93
- glView .queueEvent (new Runnable () {
94
- @ Override
95
- public void run () {
96
- mFullScreen = new FullFrameRect (
97
- new Texture2dProgram (Texture2dProgram .ProgramType .TEXTURE_EXT ));
98
- mTextureId = mFullScreen .createTextureObject ();
99
-
100
- mSurfaceTexture = new SurfaceTexture (mTextureId );
101
- mSurfaceTexture .setOnFrameAvailableListener (Capture .this );
102
- // mCameraHandler.sendMessage(mCameraHandler.obtainMessage(CameraHandler.MSG_START_CAMERA, null));
103
- startCameraImpl (0 );
104
- System .out .println ("sent starting message to UI thread" );
105
- prepareFrameBuffers ();
106
- }
107
- });
108
92
}
109
93
110
94
public void setCamera (String camera ) {
@@ -137,13 +121,33 @@ public void pause() {
137
121
mFullScreen .release (false ); // assume the GLSurfaceView EGL context is about
138
122
mFullScreen = null ; // to be destroyed
139
123
}
124
+ if (mSurfaceTexture != null ) {
125
+ mSurfaceTexture .release ();
126
+ mSurfaceTexture = null ;
127
+ }
140
128
}
141
129
142
130
public void resume () {
143
131
log ("resume called" );
144
132
if (selectedCamera != -1 ) {
145
133
startCameraImpl (selectedCamera );
146
134
}
135
+
136
+ glView .queueEvent (new Runnable () {
137
+ @ Override
138
+ public void run () {
139
+ mFullScreen = new FullFrameRect (
140
+ new Texture2dProgram (Texture2dProgram .ProgramType .TEXTURE_EXT ));
141
+ mTextureId = mFullScreen .createTextureObject ();
142
+
143
+ mSurfaceTexture = new SurfaceTexture (mTextureId );
144
+ mSurfaceTexture .setOnFrameAvailableListener (Capture .this );
145
+ // mCameraHandler.sendMessage(mCameraHandler.obtainMessage(CameraHandler.MSG_START_CAMERA, null));
146
+ startCameraImpl (0 );
147
+ System .out .println ("sent starting message to UI thread" );
148
+ prepareFrameBuffers ();
149
+ }
150
+ });
147
151
}
148
152
149
153
@ Override
0 commit comments